Plugins
In jbrowse-web and jbrowse-desktop, the top-level plugins array says what to
load. A published plugin is named by its plugin-store entry; a plugin you host
yourself is named 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. Nothing in the config pins a url or a version, which is what makes it the form to use in a config that will be read for years — a permanent url, 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 has its own, 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 is an answer computed on the day the config was written. storePlugin
defers it to load time instead, and the two can ride together — 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"
}
]
}The retired cjsUrl
The cjsUrl field is gone as of v5. It loaded a plugin by writing it to a temp
file and requireing it in jbrowse-desktop's renderer, which nothing needed:
Electron's renderer runs both other formats, and a plugin reaching the main
process does it through window.require('electron') whichever format it ships
in. A config still naming one fails that plugin by name and opens without it.