#patch-for-review:
* [x] <https://gerrit.wikimedia.org/r/419333> / {af6d8e1e97a74b4}
* [x] <https://gerrit.wikimedia.org/r/419489> / {3d15500abeda}
* [x] <https://gerrit.wikimedia.org/r/419335> / {e9b71a058b24}
* [ ] <https://gerrit.wikimedia.org/r/419334>
-------
Looking at flame graphs and overall code complexity, there's quite a bit of complexity in how Wikibase registers its JavaScript modules.
{F15215318 height=180}
entrypoint=`extensions/Wikibase/client/WikibaseClient.php`
* lib/WikibaseLib.php
** `$wgResourceModules = array_merge ...`
** lib/resources/Resources.php
*** `return array( .. ); preg_match(,,$remoteExtPath)`
* view/WikibaseView.php
** view/init.mw.php
*** view/resources.php
**** `$wgResourceModules = array_merge ...`
***** view/lib/Resources.php
****** `return array( .. )`
******* view/lib/resources/wikibase-data-model.php
******** view/lib/resources/wikibase-data-model/resources.php
********* `return array( .. ); preg_match(,,$remoteExtPath)`
******* view/lib/resources/...
******** ...
***** view/resources/Resources.php
****** `return array( .. )`
******* view/resources/jquery/resources.php
******** `return array( .. ); preg_match(,,$remoteExtPath)`
******* view/resources/...
******** ...
*** `wgHooks / ResourceLoaderRegisterModules`
**** `preg_match(,,$remoteExtPath)`
**** `$rl->register( array )`
** view/resources/Resources.php
* `$wgResourceModules = array_merge ...`
** client/resources/Resources.php
*** `return array( .. ); preg_match(,,$remoteExtPath)`
It seems the the main reason for all this complexity and indirection is that these used to be separate MediaWiki extensions where the `extensions/` path specified for `remoteExtPath` had to vary between "Name-of-micro-extension", "Wikibase" and "Wikidata".
However, as far as I can tell it will only ever be "Wikibase", given T173818 has been resolved.
Questions:
* Can all this be simplified to simple php files that return a static array with no `preg_match` complexity?
* Can we merge them upwards so that we only have a handful of these files rather than a separate one for each file that used to be its own Git repo? At the very least it'd be nice to reduce from **62 files** to less than 10, or even just 2? (One for Client, one for Repo). Note that this should not hinder future potential to publish these as separate npm packages, given that those packages will not need MediaWiki-PHP handling, and those publications can happen even a monorepo sub directory.
Related:
* {T174922}
* {T177087}
* {T75020}