framework
framework copied to clipboard
feat: introduce frontend extenders
Changes proposed in this pull request:
Prior to this, frontend extenders never actually worked before, nor could any extension use them at all as they weren't exported in compat
either. This PR does the following:
- Refactor extenders in core for them to actually work:
- They are now in the
common/extenders
directory to avoid conflicts with theextend.ts
module). - An
IExtender
interface has been introduced. - Th
Routes
andPostTypes
extenders have been adapted to the new changes and theModel
extender was removed for a separate PR.
- They are now in the
- Make use of the
Routes
andPostTypes
extenders in bundled extensions. - The extenders can be accessed by exposing an
extend
module from the extension, which contains an array of extenders.
Reviewers should focus on:
- JS Tests are only failing because
check-typings
is running before new typings are built. - The bundled extension changes were made here as an example, but I can extract them into another PR if wanted. The commits are separated though, so it should be easy to review.
Necessity
- [ ] Has the problem that is being solved here been clearly explained?
- [ ] If applicable, have various options for solving this problem been considered?
- [ ] For core PRs, does this need to be in core, or could it be in an extension?
- [ ] Are we willing to maintain this for years / potentially forever?
Confirmed
- [ ] Frontend changes: tested on a local Flarum installation.
- [ ] Backend changes: tests are green (run
composer test
). - [ ] Core developer confirmed locally this works as intended.
- [ ] Tests have been added, or are not appropriate here.