-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Async API changes may break plugins #3566
Comments
Here's an example of how an existing plugin has been modified to provide backwards compatibility: https://github.com/raybellis/ep_small_list and also an example of how that same plugin would now be written if backwards compatibility is not required: https://gist.github.com/raybellis/0a99d4762364605223bb79f84e4d59cf NB: I would expect to be able to write a cleaner method to achieve the backward compatibility such that if multiple functions are to be wrapped it wouldn't take that amount of code for each function, perhaps even adding a module to the core distribution to handle the bulk of it for them. |
We should probably add some sort of Etherpad API versioning to the internal modules (collectively, not per module) so that the /admin page can indicate which plugins are compatible. |
@raybellis Just as an idea: perhaps the compatibility can programmatically be tested at runtime, perhaps at least in some cases. |
@Wikinaut see my forked version of your plugin, which does just that. |
@raybellis In general I meant above: Etherpad core (admin module) can perhaps test (with assertions?) whether or not the installed plugins are async-compatible. |
Oh, I see - the other way around? That's kind of what I meant by a versioning system, i.e. an expectation that each plugin's |
I've made good progress writing some additional code that adds callback compatibility back into all of the exported functions that are now The code is slightly hacky, insomuch as it uses Further testing is however stalled due to #3567. |
@raybellis I confirm that also my installation (currently 64fdc73 ) is now working with the original |
Hi, I still did not integrate this into async-PR. |
The Since the patch adds back in the ability to use either method based on the arguments received the support for arity testing could be dropped, and the wrappers generated as simple closures. |
I have lost context about this issue, but I am going to release 1.8.0 anyway. |
I've cloned two existing but apparently not maintained plugins and refactored them to work with the async functions:
Note that I provide no further assurances that these are in any way safe or usable. BTW awesome that you refactored this @raybellis – the plugin code is much nicer to read now it uses async/await. I think once this is released as a proper release there would need to be a big notice saying that there are severe breaking changes in the plugin API I think otherwise people might be confused. Also from a strict semver perspective: Would the proper release version not be 2.0.0 since there are breaking changes? – I don't know if this project follows this spec. There are certainly other options. |
Hey guys, I already refactored most of my plugins so they should work. Is there a reason this issue is still open? |
We can close this issue, now that the first point release (1.8.3) after the async rewrite (1.8.0) is ready to be released, and the few actively maintained plugins have been adapted. Thanks. |
Most of the exported functions from the Etherpad internals will no longer take callback parameters in Etherpad 1.8+ (see #3540) and return Promises instead. This may break plugins that rely on those functions.
If backwards compatibility is required one solution may be to use the
nodeify
module to conditionally wrap the invocations of those exported functions.The text was updated successfully, but these errors were encountered: