forked from TypeStrong/typedoc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebugReflectionLifetimes.ts
25 lines (22 loc) · 1.13 KB
/
debugReflectionLifetimes.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* eslint-disable no-console */
import type { Application } from "../application.js";
import { ConverterEvents } from "../converter/converter-events.js";
import type { Reflection } from "../models/index.js";
export function debugReflectionLifetimes(app: Application) {
app.converter.on(ConverterEvents.CREATE_PROJECT, logCreate);
app.converter.on(ConverterEvents.CREATE_SIGNATURE, logCreate);
app.converter.on(ConverterEvents.CREATE_TYPE_PARAMETER, logCreate);
app.converter.on(ConverterEvents.CREATE_DECLARATION, logCreate);
app.converter.on(ConverterEvents.CREATE_DOCUMENT, logCreate);
app.converter.on(ConverterEvents.CREATE_PARAMETER, logCreate);
app.converter.on(ConverterEvents.CREATE_PROJECT, (_context, project) => {
const oldRemove = project["_removeReflection"];
project["_removeReflection"] = function (reflection) {
console.log("Remove", reflection.id, reflection.getFullName());
return oldRemove.call(this, reflection);
};
});
}
function logCreate(_context: unknown, refl: Reflection) {
console.log("Create", refl.variant, refl.id, refl.getFullName());
}