There is a path issue with the ResourceLoader that has arisen with the use
of Composer. Additionally, the question relates to the preferred
installation method for Wikibase and Wikibase Query. This needs to be
defined for volunteers and external people who want to use the software
outside of Wikidata. If we assume that the generally preferred method
for installation is to modify the MW_INSTALL_PATH/composer.json and add the
wikibase/wikibase and wikibase/query, after running composer, the directory
structure appears like this:
Wikibase and Query are installed in extensions and the components (except
for ValueView) are now installed to the vendor directory. This
consequently creates a problem with a bit of code that is duplicated
typically in the resources.php file of several JS components.
$remoteExtPathParts = explode(
DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR, __DIR__, 2
);
$moduleTemplate = array(
'localBasePath' => __DIR__,
'remoteExtPath' => $remoteExtPathParts[1],
);
As you can see, this is looking for the component to reside in an path that
contains "extensions". There are several questions to be answered.
1) Does this composer created directory structure work for everything
(including testing and production deployment)? (i.e. keeping things in
MW_INSTALL_PATH/vendor).
2) if so, should ValueView be moved to vendor?
3) How can the problem paths be fixed? Is this kind of flexible path magic
still necessary for the components resource loader? Or can it be
simplified by just statically defining the parent dir of the resource into
the $resources array? (the way that core currently does it).
4) What is the best way to load all JS resources for Wikibase?
Christopher