* 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: Objec
(projectOrAddon, config = { byName: {}, proxyCount: 0, realAddonInstanceCount: 0 })
| 73 | * @returns {{byName: Object, proxyCount: number, realAddonInstanceCount: number}} |
| 74 | */ |
| 75 | function countAddons(projectOrAddon, config = { byName: {}, proxyCount: 0, realAddonInstanceCount: 0 }) { |
| 76 | projectOrAddon.addons.forEach((addon) => { |
| 77 | const addonName = addon.name; |
| 78 | |
| 79 | if (!config.byName[addonName]) { |
| 80 | config.byName[addonName] = { |
| 81 | addons: [], |
| 82 | proxyCount: 0, |
| 83 | realAddonInstanceCount: 0, |
| 84 | }; |
| 85 | } |
| 86 | |
| 87 | if (addon[TARGET_INSTANCE]) { |
| 88 | config.proxyCount++; |
| 89 | config.byName[addonName].proxyCount++; |
| 90 | } else { |
| 91 | config.realAddonInstanceCount++; |
| 92 | config.byName[addonName].realAddonInstanceCount++; |
| 93 | } |
| 94 | |
| 95 | config.byName[addonName].addons.push(addon); |
| 96 | countAddons(addon, config); |
| 97 | }); |
| 98 | |
| 99 | return config; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Generate the file structure used for the cache-bundle-hosts and enable-cache tests. |
no outgoing calls
no test coverage detected
searching dependent graphs…