* Build a map of {sanitizedPluginName: hookCount} from matched hooks. * Only logs actual names for official marketplace plugins; others become 'third-party'.
( hooks: MatchedHook[], )
| 1596 | * Only logs actual names for official marketplace plugins; others become 'third-party'. |
| 1597 | */ |
| 1598 | function getPluginHookCounts( |
| 1599 | hooks: MatchedHook[], |
| 1600 | ): Record<string, number> | undefined { |
| 1601 | const pluginHooks = hooks.filter(h => h.pluginId) |
| 1602 | if (pluginHooks.length === 0) { |
| 1603 | return undefined |
| 1604 | } |
| 1605 | const counts: Record<string, number> = {} |
| 1606 | for (const h of pluginHooks) { |
| 1607 | const atIndex = h.pluginId!.lastIndexOf('@') |
| 1608 | const isOfficial = |
| 1609 | atIndex > 0 && |
| 1610 | ALLOWED_OFFICIAL_MARKETPLACE_NAMES.has(h.pluginId!.slice(atIndex + 1)) |
| 1611 | const key = isOfficial ? h.pluginId! : 'third-party' |
| 1612 | counts[key] = (counts[key] || 0) + 1 |
| 1613 | } |
| 1614 | return counts |
| 1615 | } |
| 1616 | |
| 1617 | /** |
| 1618 | * Build a map of {hookType: count} from matched hooks. |
no test coverage detected