Skip to content

Commit 745cd9d

Browse files
committed
Add generateOutputs{Begin,End} events
1 parent 0135da0 commit 745cd9d

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ title: Changelog
44

55
## Unreleased
66

7+
### Features
8+
9+
- Introduced `generateOutputsBegin` and `generateOutputsEnd` events on `Application` for plugin use.
10+
711
## v0.28.19 (2026-04-12)
812

913
### Features

src/lib/application-events.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ export const ApplicationEvents = {
22
BOOTSTRAP_END: "bootstrapEnd",
33
REVIVE: "reviveProject",
44
VALIDATE_PROJECT: "validateProject",
5+
GENERATE_OUTPUTS_BEGIN: "generateOutputsBegin",
6+
GENERATE_OUTPUTS_END: "generateOutputsEnd",
57
} as const;

src/lib/application.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ export interface ApplicationEvents {
7878
bootstrapEnd: [Application];
7979
reviveProject: [ProjectReflection];
8080
validateProject: [ProjectReflection];
81+
generateOutputsBegin: [ProjectReflection];
82+
generateOutputsEnd: [ProjectReflection];
8183
}
8284

8385
/**
@@ -178,21 +180,40 @@ export class Application extends AbstractComponent<
178180
/**
179181
* Emitted after plugins have been loaded and options have been read, but before they have been frozen.
180182
* The listener will be given an instance of {@link Application}.
183+
* @event
181184
*/
182185
static readonly EVENT_BOOTSTRAP_END = ApplicationEvents.BOOTSTRAP_END;
183186

184187
/**
185188
* Emitted after a project has been deserialized from JSON.
186189
* The listener will be given an instance of {@link ProjectReflection}.
190+
* @event
187191
*/
188192
static readonly EVENT_PROJECT_REVIVE = ApplicationEvents.REVIVE;
189193

190194
/**
191195
* Emitted when validation is being run.
192196
* The listener will be given an instance of {@link ProjectReflection}.
197+
* @event
193198
*/
194199
static readonly EVENT_VALIDATE_PROJECT = ApplicationEvents.VALIDATE_PROJECT;
195200

201+
/**
202+
* Emitted just before outputs are generated. This can be used by plugins which generate
203+
* additional auxiliary output files to avoid generating output if the user has validation
204+
* warnings and treat warnings as errors is enabled.
205+
* @event
206+
*/
207+
static readonly EVENT_GENERATE_OUTPUTS_BEGIN = ApplicationEvents.GENERATE_OUTPUTS_BEGIN;
208+
209+
/**
210+
* Emitted just after outputs are generated. This can be used by plugins which generate
211+
* additional auxiliary output files to avoid generating output if the user has validation
212+
* warnings and treat warnings as errors is enabled.
213+
* @event
214+
*/
215+
static readonly EVENT_GENERATE_OUTPUTS_END = ApplicationEvents.GENERATE_OUTPUTS_END;
216+
196217
/**
197218
* Create a new TypeDoc application instance.
198219
*/
@@ -712,7 +733,9 @@ export class Application extends AbstractComponent<
712733
* Render outputs selected with options for the specified project
713734
*/
714735
public async generateOutputs(project: ProjectReflection): Promise<void> {
736+
this.trigger(Application.EVENT_GENERATE_OUTPUTS_BEGIN, project);
715737
await this.outputs.writeOutputs(project);
738+
this.trigger(Application.EVENT_GENERATE_OUTPUTS_END, project);
716739
}
717740

718741
/**

0 commit comments

Comments
 (0)