* Build a map of {sanitizedPluginName: hookCount} from matched hooks. * Only logs actual names for official marketplace plugins; others become 'third-party'.
( hooks: MatchedHook[], )
| 1463 | * Only logs actual names for official marketplace plugins; others become 'third-party'. |
| 1464 | */ |
| 1465 | function getPluginHookCounts( |
| 1466 | hooks: MatchedHook[], |
| 1467 | ): Record<string, number> | undefined { |
| 1468 | const pluginHooks = hooks.filter(h => h.pluginId) |
| 1469 | if (pluginHooks.length === 0) { |
| 1470 | return undefined |
| 1471 | } |
| 1472 | const counts: Record<string, number> = {} |
| 1473 | for (const h of pluginHooks) { |
| 1474 | const atIndex = h.pluginId!.lastIndexOf('@') |
| 1475 | const isOfficial = |
| 1476 | atIndex > 0 && |
| 1477 | ALLOWED_OFFICIAL_MARKETPLACE_NAMES.has(h.pluginId!.slice(atIndex + 1)) |
| 1478 | const key = isOfficial ? h.pluginId! : 'third-party' |
| 1479 | counts[key] = (counts[key] || 0) + 1 |
| 1480 | } |
| 1481 | return counts |
| 1482 | } |
| 1483 | |
| 1484 | |
| 1485 | /** |
no test coverage detected