Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update JsPlugin for proper server-side support #16

Merged
merged 5 commits into from
Dec 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 root(self) -> typing.Generator[pathlib.Path, None, None]:
"""
The root directory of the resources to serve. The root must exist.
"""
devinrsmith marked this conversation as resolved.
Show resolved Hide resolved
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