(cwd?: string)
| 42 | } |
| 43 | |
| 44 | async doInitialize(cwd?: string): Promise<HookServiceState> { |
| 45 | if (cwd) { |
| 46 | this.cwd = cwd; |
| 47 | } |
| 48 | |
| 49 | const loaded = loadHooksConfig(this.cwd); |
| 50 | |
| 51 | const eventCount = Object.keys(loaded.hooks).length; |
| 52 | const handlerCount = Object.values(loaded.hooks).reduce( |
| 53 | (sum, groups) => |
| 54 | sum + (groups?.reduce((s, g) => s + g.hooks.length, 0) ?? 0), |
| 55 | 0, |
| 56 | ); |
| 57 | |
| 58 | if (handlerCount > 0) { |
| 59 | logger.debug( |
| 60 | `Hooks loaded: ${handlerCount} handler(s) across ${eventCount} event type(s)`, |
| 61 | ); |
| 62 | } |
| 63 | |
| 64 | return { |
| 65 | config: loaded.hooks, |
| 66 | disabled: loaded.disabled, |
| 67 | onceKeys: new Set(), |
| 68 | }; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Fire a hook event and return the aggregated result. |
no test coverage detected