From 833c8759b2c1dd21f8443eeea68f296227bb81b9 Mon Sep 17 00:00:00 2001 From: Gerrit Birkeland Date: Sun, 9 Jul 2023 13:05:14 -0600 Subject: [PATCH] Fix inheritDoc across packages in packages mode Resolves #2331 --- CHANGELOG.md | 1 + src/lib/converter/plugins/InheritDocPlugin.ts | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bf9205e2..2f68cc671 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### Bug Fixes - Fixed duplicate definitions in type hierarchy when using packages mode, #2327. +- `@inheritDoc` was not properly resolved across packages in packages mode, #2331. ## v0.24.8 (2023-06-04) diff --git a/src/lib/converter/plugins/InheritDocPlugin.ts b/src/lib/converter/plugins/InheritDocPlugin.ts index 1a9592b6b..f25208505 100644 --- a/src/lib/converter/plugins/InheritDocPlugin.ts +++ b/src/lib/converter/plugins/InheritDocPlugin.ts @@ -10,7 +10,7 @@ import { Component, ConverterComponent } from "../components"; import { Converter } from "../converter"; import type { Context } from "../context"; import type { Reflection } from "../../models/reflections/abstract"; -import { DefaultMap } from "../../utils"; +import { BindOption, DefaultMap, ValidationOptions } from "../../utils"; import { zip } from "../../utils/array"; import { parseDeclarationReference } from "../comments/declarationReference"; import { resolveDeclarationReference } from "../comments/declarationReferenceResolver"; @@ -31,6 +31,9 @@ import { ApplicationEvents } from "../../application-events"; */ @Component({ name: "inheritDoc" }) export class InheritDocPlugin extends ConverterComponent { + @BindOption("validation") + validation!: ValidationOptions; + // Key is depended on by Values private dependencies = new DefaultMap(() => []); @@ -41,7 +44,11 @@ export class InheritDocPlugin extends ConverterComponent { this.owner.on(Converter.EVENT_RESOLVE_END, (context: Context) => this.processInheritDoc(context.project) ); - this.owner.on(ApplicationEvents.REVIVE, this.processInheritDoc, this); + this.application.on( + ApplicationEvents.REVIVE, + this.processInheritDoc, + this + ); } /** @@ -90,9 +97,11 @@ export class InheritDocPlugin extends ConverterComponent { } if (!sourceRefl) { - this.application.logger.warn( - `Failed to find "${source}" to inherit the comment from in the comment for ${reflection.getFullName()}` - ); + if (this.validation.invalidLink) { + this.application.logger.warn( + `Failed to find "${source}" to inherit the comment from in the comment for ${reflection.getFullName()}` + ); + } continue; }