-
Notifications
You must be signed in to change notification settings - Fork 712
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Produce warnings if links cannot be resolved
Ref: #2808
- Loading branch information
Showing
27 changed files
with
313 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* eslint-disable no-console */ | ||
import { join } from "node:path"; | ||
import type { Application } from "../application.js"; | ||
import { Reflection, type SomeReflection } from "../models/index.js"; | ||
import type { SerializerComponent } from "../serialization/components.js"; | ||
import type { JSONOutput } from "../serialization/index.js"; | ||
|
||
const serializer: SerializerComponent<SomeReflection> = { | ||
priority: 0, | ||
supports(x) { | ||
return x instanceof Reflection; | ||
}, | ||
toObject(item, obj: any) { | ||
obj.url = item.url; | ||
obj.hasOwnDocument = item.hasOwnDocument; | ||
// obj.anchor = item.anchor; | ||
delete obj.sources; | ||
delete obj.groups; | ||
delete obj.categories; | ||
delete obj.readme; | ||
delete obj.content; | ||
delete obj.kind; | ||
delete obj.flags; | ||
delete obj.defaultValue; | ||
delete obj.symbolIdMap; | ||
delete obj.files; | ||
delete obj.packageName; | ||
delete obj.variant; | ||
delete obj.extendedTypes; | ||
delete obj.inheritedFrom; | ||
if (!["reflection", "reference"].includes(obj.type?.type)) { | ||
delete obj.type; | ||
} | ||
|
||
if (obj.comment) { | ||
obj.comment.summary = obj.comment.summary.filter( | ||
(part: JSONOutput.CommentDisplayPart) => | ||
part.kind === "inline-tag", | ||
); | ||
obj.comment.blockTags = obj.comment.blockTags?.filter( | ||
(tag: JSONOutput.CommentTag) => { | ||
tag.content = tag.content.filter( | ||
(part) => part.kind === "inline-tag", | ||
); | ||
return tag.content.length; | ||
}, | ||
); | ||
|
||
if ( | ||
!obj.comment.summary.length && | ||
!obj.comment.blockTags?.length && | ||
!obj.comment.modifierTags | ||
) { | ||
delete obj.comment; | ||
} | ||
} | ||
|
||
return obj; | ||
}, | ||
}; | ||
|
||
export function debugRendererUrls( | ||
app: Application, | ||
{ json = false, logs = false } = { logs: true }, | ||
) { | ||
app.renderer.postRenderAsyncJobs.push(async (evt) => { | ||
if (json) { | ||
app.serializer.addSerializer(serializer); | ||
await app.generateJson( | ||
evt.project, | ||
join(evt.outputDirectory, "url_debug.json"), | ||
); | ||
app.serializer.removeSerializer(serializer); | ||
} | ||
|
||
if (logs) { | ||
for (const id in evt.project.reflections) { | ||
const refl = evt.project.reflections[id]; | ||
console.log( | ||
refl.id, | ||
refl.getFullName(), | ||
refl.url, | ||
refl.hasOwnDocument, | ||
); | ||
} | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { debugRendererUrls } from "./debugRendererUrls.js"; | ||
export { debugReflectionLifetimes } from "./debugReflectionLifetimes.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.