-
Notifications
You must be signed in to change notification settings - Fork 60
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
Fix relative path loading of plugins #3266
Conversation
also, I removed the strict check for the plugin class being an instanceof Plugin, since i think it is easier to just say that it is a basic class. If needed, we can make the handwritten plugin "extend JBrowseExports["@jbrowse/core/Plugin"]" or something like that to fulfill instanceof but I think it may not truly be needed |
import ReExports from './ReExports' | ||
import { isElectron } from './util' | ||
|
||
export const PluginSourceConfigurationSchema = ConfigurationSchema( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was unused :)
'umdUrl' in p && | ||
storePlugin.umdUrl === p.umdUrl)), | ||
p => | ||
isUMDPluginDefinition(p) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i didn't add checks for e.g. umdLoc here because since i didn't think our plugin store would use this
679dbe1
to
dbab27b
Compare
Codecov Report
@@ Coverage Diff @@
## main #3266 +/- ##
==========================================
+ Coverage 59.45% 59.49% +0.04%
==========================================
Files 676 676
Lines 28828 28807 -21
Branches 7039 7041 +2
==========================================
+ Hits 17139 17140 +1
+ Misses 11415 11393 -22
Partials 274 274
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
19b9f93
to
61f6447
Compare
61f6447
to
f188304
Compare
@carolinebridge-oicr I updated the no-build plugin tutorial to reflect some of the lessons learned from this PR, and tagged you for review too. I changed the no-build tutorial to use a UMD type plugin, and removed the unpkg code since that would use ESM. Perhaps could be added back in the future if ESM gets supported by firefox |
3a31d2c
to
26b0b53
Compare
26b0b53
to
b14de5d
Compare
I think this should be good to go...might go ahead with merge |
Might be good to at least check that the plugin has |
058c2b4
to
d1545a8
Compare
cool :) added checks for install and configure at least existing as properties made it so that 'install' and 'configure' substitute for the instanceof-style check d1545a8 (had done a different thing to detect the different types of 'load' records, but this seems better) |
Fixes #3262
It adds two examples of loading a UMD plugin to the volvox config
Firstly, this PR makes umdUrl, an existing method for configuring plugin URLs, always loaded relative to index.html. The issue #3262 describes why this wasn't working with relative paths currently
Secondly, this PR also adds new settings, esmLoc/umdLoc, which resolve the plugin location relative to the current config.json being used, which is similar to other "loc" objects in our config files (e.g. track data file locations like bam, bigwig, gff, etc are assumed to be in the same "folder" as the config.json)
I didn't add cjsLoc (commonjs) yet, used for desktop plugins, but can add it if there is interest
Finally, I added examples to the volvox config using umdUrl and umdLoc. I did NOT use esmUrl/esmLoc because it does not work in firefox with webworkers. firefox cannot load ESM modules in workers currently, though they may add it in the future.
As a result, I added a "minimal" UMD style plugin that can be handwritten. It's more annoying to write this way than ESM but, more browser compatibility
Example minimal plugin