Feature request from fooman, posted on GitHub Feb 14, 2016
This code
private function load()
{
if ($this->packageModuleMap === null) {
$jsonData = $this->reader->getComposerJsonFiles()->toArray();
foreach ($this->componentRegistrar->getPaths(ComponentRegistrar::MODULE) as $moduleName => $moduleDir) {
$key = $moduleDir . '/composer.json';
assumes that the registered path also holds the composer.json file which is not necessarily the case (for example https://github.com/fooman/sameorderinvoicenumber-m2/tree/v2.0.2/src). I am hoping there is a way to query composer itself for all packages of type magento2-module.