function countAddons(projectOrAddon, config = { byName: {}, proxyCount: 0, realAddonInstanceCount: 0 }) {
  projectOrAddon.addons.forEach((addon) => {
    const addonName = addon.name;

    if (!config.byName[addonName]) {
      config.byName[addonName] = {
        addons: [],
        proxyCount: 0,
        realAddonInstanceCount: 0,
      };
    }

    if (addon[TARGET_INSTANCE]) {
      config.proxyCount++;
      config.byName[addonName].proxyCount++;
    } else {
      config.realAddonInstanceCount++;
      config.byName[addonName].realAddonInstanceCount++;
    }

    config.byName[addonName].addons.push(addon);
    countAddons(addon, config);
  });

  return config;
}
For a given project/addon, this counts addon instances within said project/addon;
specifically we're interested in the number of "real" addon instances, and proxy
objects.

@name countAddons
@param {Project|Addon} projectOrAddon
@param {Object} [config]
@returns {{byName: Object, proxyCount: number, realAddonInstanceCount: number}}