Skip to content

Commit

Permalink
Update JsPlugin for proper server-side support (#16)
Browse files Browse the repository at this point in the history
In addition, updates JsPlugin documentation to be more consistent with deephaven/deephaven-core#4925

Fixes #15
  • Loading branch information
devinrsmith committed Dec 13, 2023
1 parent aab7835 commit 1aed15b
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/deephaven/plugin/js.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,44 @@


class JsPlugin(Plugin):
"""A js plugin. Useful for adding custom JS code to the server that can be passed to the web client."""
"""
A JS plugin is a Plugin that allows adding javascript code under the server's URL path "js-plugins/".
See https://github.com/deephaven/deephaven-plugins#js-plugins for more details about the underlying
construction for JS plugins.
"""

@abc.abstractmethod
def distribution_path(self) -> typing.Generator[pathlib.Path, None, None]:
"""A generator that yields the distribution path directory."""
def path(self) -> pathlib.Path:
"""
The directory path of the resources to serve. The path must exist.
"""
pass

@property
@abc.abstractmethod
def name(self) -> str:
"""The plugin name"""
"""
The JS plugin name. The JS plugin contents will be served via the URL path "js-plugins/{name}/",
as well as included as the "name" field for the manifest entry in "js-plugins/manifest.json".
"""
pass

@property
@abc.abstractmethod
def version(self) -> str:
"""The plugin version"""
"""
The JS plugin version. Will be included as the "version" field for the manifest entry in
js-plugins/manifest.json".
"""
pass

@property
@abc.abstractmethod
def main(self) -> str:
"""The main js file, the relative path with respect to distribution_path."""
"""
The main JS file path, specified relative to root. The main JS file must exist. Will be included
as the "main" field for the manifest entry in "js-plugins/manifest.json".
"""
pass

def __str__(self) -> str:
Expand Down

0 comments on commit 1aed15b

Please sign in to comment.