You can infer an answer to this from the example app in FPF. A plugin can export an arbitrary number of components, which can then be individually imported and assigned to slots in the configuration file.
Yes, the example components in the example app only export one component per file, but you could package that whole directory as an NPM module and call it a plugin. Alternatively, you could export many components from a single file.
The important thing is that it is not up to the plugin codebase to say where it will be slotted. Neither is it up to the host MFE. This is left to the MFE user via the configuration file.
Generally speaking, I dare say that this is comparing apples and oranges. As I understand it (though I’m no expert), Wordpress is much more akin to Django and the template system we had in edx-platform, or even Tutor itself, the difference being that it’s written in PHP, and so are its plugins. Which is to say, the template engine lends itself well to a hook system that applies to both backend and frontend.
Micro-frontends, specially ones based on React, are a different matter. To start with, they’re decoupled from the backend code. Writing a single hook system to encompass both would be very complicated - I’d argue too complicated to be worth it, at least for the moment. I suggest we instead keep the paradigms separate, and let the MFEs have their own separate system.
Otherwise, from what I can tell it’s possible to compare the Wordpress filter hooks to what we’re doing with FPF more directly. I suspect the only differences are:
- FPF requires declarative configuration, where Wordpress filters are imperative
- FPF only “filters” specific UI slots
I stand by Braden’s argument that declarative configuration is actually better in the micro-frontend/Node/webpack world.
As for the second point, it’s just a reduction in scope. Like Wordpress’ actions, I can imagine having more generic hooks in FPF in the future, but I’d argue that they would make more sense when/if MFEs are more standardized in their data flow than they are now.