Plugins
In jbrowse-web and jbrowse-desktop, the top-level plugins array lists what to
load: a published plugin by its plugin-store entry, and a plugin you host
yourself by its url.
{
"plugins": [
{ "storePlugin": "MsaView" },
{
"name": "MyPlugin",
"url": "https://example.com/plugins/myplugin.umd.js"
},
{
"name": "MyLocalPlugin",
"umdLoc": { "uri": "myplugin.umd.js" }
}
]
}storePluginis the name the plugin store lists it under. JBrowse resolves it against the store when the config loads, picking a build published for the version of JBrowse doing the reading and checking its integrity hash. The config pins no url or version, so this is the form to use in a config that will be read for years, such as a permanent url or a track hub. Plugin authors submit a PR to jbrowse-plugin-list to be listed.namemust match the plugin's own registration (name = 'MyPlugin'in the plugin class) for a UMD build, which is looked up by that name once its script has run. An ESM build declares its own name, and a store entry supplies one.- Embedded components load plugins inline; see the inline plugins example.
Naming a build directly
url is the simplest field and equals umdUrl. The others differ in module
format and in what the path resolves against:
| Field | Module format | Path resolved relative to |
|---|---|---|
url |
UMD | index.html |
umdUrl |
UMD | index.html |
umdLoc |
UMD | config.json |
esmUrl |
ESM | index.html |
esmLoc |
ESM | config.json |
umdLoc/esmLoc suit a plugin file that lives beside config.json. Both formats
load on the main thread and in the RPC workers. An ESM build can split into
chunks that load when first used, which a UMD build cannot; see
What your plugin costs at load.
Add integrity beside a UMD url to have the browser check the bytes against the
hash before running them; the store publishes one for each UMD build.
A url pins the build chosen when the config was written, and storePlugin
resolves the build at load time. A config can give both: the ref for a JBrowse
that resolves it, the url for one that does not, and as the fallback when the
store cannot be reached:
{
"plugins": [
{
"storePlugin": "MsaView",
"name": "MsaView",
"url": "https://jbrowse.org/plugins/jbrowse-plugin-msaview/3.10.0/dist/jbrowse-plugin-msaview.umd.production.min.js"
}
]
}cjsUrl
A plugin entry naming cjsUrl fails that plugin by name, and the config opens
without it. Use url/umdUrl or esmUrl.
See also
- User guide: Installing plugins
- Developer guide: No-build plugin
- Developer guide: Simple plugin tutorial
- Docs: Developer guide