From 1aed15b42cdfe787912c432884dc6495c87dd805 Mon Sep 17 00:00:00 2001 From: Devin Smith Date: Wed, 13 Dec 2023 09:13:39 -0800 Subject: [PATCH] Update JsPlugin for proper server-side support (#16) In addition, updates JsPlugin documentation to be more consistent with https://github.com/deephaven/deephaven-core/pull/4925 Fixes #15 --- src/deephaven/plugin/js.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/deephaven/plugin/js.py b/src/deephaven/plugin/js.py index 39fc743..055f9bf 100644 --- a/src/deephaven/plugin/js.py +++ b/src/deephaven/plugin/js.py @@ -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: