Skip to content

Commit

Permalink
feat(deps): update dependency typedoc to 0.23.8 (#19)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Updated dependency `typedoc` to `0.23.8`
BREAKING CHANGE: `CommentParser#tags` has been removed along with `#tags` in related interfaces. Use `#blockTags` and `#modifierTags` instead.
BREAKING CHANGE: `CommentParser#extendedDescription` has been removed and merged with `#description` along with related interfaces.
  • Loading branch information
RealShadowNova committed Jul 27, 2022
1 parent 6dc7a28 commit 63d2b6f
Show file tree
Hide file tree
Showing 15 changed files with 66 additions and 58 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
"dependencies": {
"@favware/colorette-spinner": "^1.0.0",
"colorette": "^2.0.19",
"commander": "^9.3.0",
"commander": "^9.4.0",
"js-yaml": "^4.1.0",
"typedoc": "^0.22.18"
"typedoc": "^0.23.8"
},
"devDependencies": {
"@commitlint/cli": "^17.0.3",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/structures/ConstantParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class ConstantParser extends Parser {
* @returns The generated parser.
*/
public static generateFromTypeDoc(reflection: JSONOutput.DeclarationReflection, project: ProjectParser): ConstantParser {
const { kind, kindString = 'Unknown', id, name, comment = {}, sources = [], flags, type, defaultValue } = reflection;
const { kind, kindString = 'Unknown', id, name, comment = { summary: [] }, sources = [], flags, type, defaultValue } = reflection;

if (kind !== ReflectionKind.Variable) throw new Error(`Expected Variable (${ReflectionKind.Variable}), but received ${kindString} (${kind})`);

Expand Down
2 changes: 1 addition & 1 deletion src/lib/structures/FunctionParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class FunctionParser extends Parser {
* @returns The generated parser.
*/
public static generateFromTypeDoc(reflection: JSONOutput.DeclarationReflection, project: ProjectParser): FunctionParser {
const { kind, kindString = 'Unknown', id, name, comment = {}, sources = [], flags, signatures = [] } = reflection;
const { kind, kindString = 'Unknown', id, name, comment = { summary: [] }, sources = [], flags, signatures = [] } = reflection;

if (kind !== ReflectionKind.Function) throw new Error(`Expected Function (${ReflectionKind.Function}), but received ${kindString} (${kind})`);

Expand Down
2 changes: 1 addition & 1 deletion src/lib/structures/NamespaceParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class NamespaceParser extends Parser {
* @returns The generated parser.
*/
public static generateFromTypeDoc(reflection: JSONOutput.DeclarationReflection, project: ProjectParser): NamespaceParser {
const { kind, kindString = 'Unknown', id, name, comment = {}, sources = [], flags, children = [] } = reflection;
const { kind, kindString = 'Unknown', id, name, comment = { summary: [] }, sources = [], flags, children = [] } = reflection;

if (kind !== ReflectionKind.Namespace) throw new Error(`Expected Namespace (${ReflectionKind.Namespace}), but received ${kindString} (${kind})`);

Expand Down
2 changes: 1 addition & 1 deletion src/lib/structures/TypeAliasParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class TypeAliasParser extends Parser {
* @returns The generated parser.
*/
public static generateFromTypeDoc(reflection: JSONOutput.DeclarationReflection, project: ProjectParser): TypeAliasParser {
const { kind, kindString = 'Unknown', id, name, comment = {}, sources = [], flags, type, typeParameter: typeParameters = [] } = reflection;
const { kind, kindString = 'Unknown', id, name, comment = { summary: [] }, sources = [], flags, type, typeParameters = [] } = reflection;

if (kind !== ReflectionKind.TypeAlias) throw new Error(`Expected TypeAlias (${ReflectionKind.TypeAlias}), but received ${kindString} (${kind})`);

Expand Down
2 changes: 1 addition & 1 deletion src/lib/structures/class-parser/ClassConstructorParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class ClassConstructorParser extends Parser {
* @returns The generated parser.
*/
public static generateFromTypeDoc(reflection: JSONOutput.DeclarationReflection, project: ProjectParser): ClassConstructorParser {
const { kind, kindString = 'Unknown', id, name, comment = {}, sources = [], signatures = [] } = reflection;
const { kind, kindString = 'Unknown', id, name, comment = { summary: [] }, sources = [], signatures = [] } = reflection;

if (kind !== ReflectionKind.Constructor) {
throw new Error(`Expected Constructor (${ReflectionKind.Constructor}), but received ${kindString} (${kind})`);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/structures/class-parser/ClassMethodParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class ClassMethodParser extends Parser {
* @returns The generated parser.
*/
public static generateFromTypeDoc(reflection: JSONOutput.DeclarationReflection, project: ProjectParser): ClassMethodParser {
const { kind, kindString = 'Unknown', id, name, comment = {}, sources = [], flags, signatures = [] } = reflection;
const { kind, kindString = 'Unknown', id, name, comment = { summary: [] }, sources = [], flags, signatures = [] } = reflection;

if (kind !== ReflectionKind.Method) throw new Error(`Expected Method (${ReflectionKind.Method}), but received ${kindString} (${kind})`);

Expand Down
2 changes: 1 addition & 1 deletion src/lib/structures/class-parser/ClassParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class ClassParser extends Parser {
kindString = 'Unknown',
id,
name,
comment = {},
comment = { summary: [] },
sources = [],
flags,
children = [],
Expand Down
8 changes: 3 additions & 5 deletions src/lib/structures/class-parser/ClassPropertyParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class ClassPropertyParser extends Parser {
* @returns The generated parser.
*/
public static generateFromTypeDoc(reflection: JSONOutput.DeclarationReflection, project: ProjectParser): ClassPropertyParser {
const { kind, kindString = 'Unknown', id, name, comment = {}, sources = [], type, flags } = reflection;
const { kind, kindString = 'Unknown', id, name, comment = { summary: [] }, sources = [], type, flags, getSignature } = reflection;

if (kind !== ReflectionKind.Property && kind !== ReflectionKind.Accessor) {
throw new Error(
Expand All @@ -94,11 +94,9 @@ export class ClassPropertyParser extends Parser {
}

if (kind === ReflectionKind.Accessor) {
const [getter] = reflection.getSignature ?? [];
if (getSignature === undefined) throw new Error(`Expected Accessor (${ReflectionKind.Accessor}) with a getter, but there was none`);

if (getter === undefined) throw new Error(`Expected Accessor (${ReflectionKind.Accessor}) with a getter, but there was none`);

const { id, name, comment = {}, type, flags } = getter;
const { id, name, comment = { summary: [] }, type, flags } = getSignature;

return new ClassPropertyParser(
{
Expand Down
2 changes: 1 addition & 1 deletion src/lib/structures/enum-parser/EnumParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class EnumParser extends Parser {
* @returns The generated parser.
*/
public static generateFromTypeDoc(reflection: JSONOutput.DeclarationReflection, project: ProjectParser): EnumParser {
const { kind, kindString = 'Unknown', id, name, comment = {}, sources = [], flags, children = [] } = reflection;
const { kind, kindString = 'Unknown', id, name, comment = { summary: [] }, sources = [], flags, children = [] } = reflection;

if (kind !== ReflectionKind.Enum) throw new Error(`Expected Enum (${ReflectionKind.Enum}), but received ${kindString} (${kind})`);

Expand Down
5 changes: 3 additions & 2 deletions src/lib/structures/enum-parser/EnumPropertyParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ReflectionKind } from '../../types';
import { CommentParser, SourceParser } from '../misc';
import { Parser } from '../Parser';
import type { ProjectParser } from '../ProjectParser';
import { TypeParser } from '../type-parsers';

/**
* Parses data from an enum property reflection.
Expand Down Expand Up @@ -43,7 +44,7 @@ export class EnumPropertyParser extends Parser {
* @returns The generated parser.
*/
public static generateFromTypeDoc(reflection: JSONOutput.DeclarationReflection, project: ProjectParser): EnumPropertyParser {
const { kind, kindString = 'Unknown', id, name, comment = {}, sources = [], defaultValue } = reflection;
const { kind, kindString = 'Unknown', id, name, comment = { summary: [] }, sources = [], type } = reflection;

if (kind !== ReflectionKind.EnumMember) {
throw new Error(`Expected EnumMember (${ReflectionKind.EnumMember}), but received ${kindString} (${kind})`);
Expand All @@ -55,7 +56,7 @@ export class EnumPropertyParser extends Parser {
name,
comment: CommentParser.generateFromTypeDoc(comment, project),
source: sources.length ? SourceParser.generateFromTypeDoc(sources[0], project) : null,
value: defaultValue!
value: TypeParser.generateFromTypeDoc(type!).toString()
},
project
);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/structures/interface-parser/InterfaceParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class InterfaceParser extends Parser {
* @returns The generated parser.
*/
public static generateFromTypeDoc(reflection: JSONOutput.DeclarationReflection, project: ProjectParser): InterfaceParser {
const { kind, kindString = 'Unknown', id, name, comment = {}, sources = [], flags, children = [] } = reflection;
const { kind, kindString = 'Unknown', id, name, comment = { summary: [] }, sources = [], flags, children = [] } = reflection;

if (kind !== ReflectionKind.Interface) throw new Error(`Expected Interface (${ReflectionKind.Interface}), but received ${kindString} (${kind})`);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class InterfacePropertyParser extends Parser {
* @returns The generated parser.
*/
public static generateFromTypeDoc(reflection: JSONOutput.DeclarationReflection, project: ProjectParser): InterfacePropertyParser {
const { kind, kindString = 'Unknown', id, name, comment = {}, sources = [], type, flags } = reflection;
const { kind, kindString = 'Unknown', id, name, comment = { summary: [] }, sources = [], type, flags } = reflection;

if (kind !== ReflectionKind.Property) throw new Error(`Expected Property (${ReflectionKind.Property}), but received ${kindString} (${kind})`);

Expand Down
63 changes: 33 additions & 30 deletions src/lib/structures/misc/CommentParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,47 +18,47 @@ export class CommentParser {
public readonly description: string | null;

/**
* The extended description of this comment.
* The block tags of this comment.
* @since 1.0.0
*/
public readonly extendedDescription: string | null;
public readonly blockTags: CommentParser.BlockTag[];

/**
* The tags of this comment.
* The modifier tags of this comment.
* @since 1.0.0
*/
public readonly tags: CommentParser.Tag[];
public readonly modifierTags: string[];

/**
* The filtered `@see` tags of this comment.
* @since 1.0.0
*/
public get see(): CommentParser.Tag[] {
return this.tags.filter((tag) => tag.name === 'see');
public get see(): CommentParser.BlockTag[] {
return this.blockTags.filter((tag) => tag.name === 'see');
}

/**
* The filtered `@example` tags of this comment.
* @since 1.0.0
*/
public get example(): CommentParser.Tag[] {
return this.tags.filter((tag) => tag.name === 'example');
public get example(): CommentParser.BlockTag[] {
return this.blockTags.filter((tag) => tag.name === 'example');
}

/**
* Whether the comment has an `@deprecated` tag.
* @since 1.0.0
*/
public get deprecated(): boolean {
return this.tags.some((tag) => tag.name === 'deprecated');
return this.modifierTags.some((tag) => tag === 'deprecated');
}

public constructor(data: CommentParser.Data, project: ProjectParser) {
const { description, extendedDescription, tags } = data;
const { description, blockTags, modifierTags } = data;

this.description = description;
this.extendedDescription = extendedDescription;
this.tags = tags;
this.blockTags = blockTags;
this.modifierTags = modifierTags;

this.project = project;
}
Expand All @@ -71,8 +71,8 @@ export class CommentParser {
public toJSON(): CommentParser.JSON {
return {
description: this.description,
extendedDescription: this.extendedDescription,
tags: this.tags
blockTags: this.blockTags,
modifierTags: this.modifierTags
};
}

Expand All @@ -84,26 +84,29 @@ export class CommentParser {
* @returns The generated parser.
*/
public static generateFromTypeDoc(comment: JSONOutput.Comment, project: ProjectParser): CommentParser {
const { shortText, text, tags } = comment;
const { summary, blockTags = [], modifierTags = [] } = comment;

return new CommentParser(
{
description: shortText ?? text ?? null,
extendedDescription: text ?? null,
tags: tags?.map((tag) => ({ name: tag.tag, text: tag.text.trim() })) ?? []
description: summary.length ? summary.map((summary) => summary.text).join('\n') : null,
blockTags: blockTags.map((tag) => ({
name: tag.name ?? tag.tag.replace(/@/, ''),
text: tag.content.map((content) => content.text).join('\n')
})),
modifierTags
},
project
);
}

public static generateFromJSON(json: CommentParser.JSON, project: ProjectParser): CommentParser {
const { description, extendedDescription, tags } = json;
const { description, blockTags, modifierTags } = json;

return new CommentParser(
{
description,
extendedDescription,
tags
blockTags,
modifierTags
},
project
);
Expand All @@ -119,16 +122,16 @@ export namespace CommentParser {
description: string | null;

/**
* The extended description of this comment.
* The block tags of this comment.
* @since 1.0.0
*/
extendedDescription: string | null;
blockTags: BlockTag[];

/**
* The tags of this comment.
* The modifier tags of this comment.
* @since 1.0.0
*/
tags: Tag[];
modifierTags: string[];
}

export interface JSON {
Expand All @@ -139,23 +142,23 @@ export namespace CommentParser {
description: string | null;

/**
* The extended description of this comment.
* The block tags of this comment.
* @since 1.0.0
*/
extendedDescription: string | null;
blockTags: BlockTag[];

/**
* The tags of this comment.
* The modifier tags of this comment.
* @since 1.0.0
*/
tags: Tag[];
modifierTags: string[];
}

/**
* A tag of a comment.
* @since 1.0.0
*/
export interface Tag {
export interface BlockTag {
/**
* The name of this tag.
* @since 1.0.0
Expand Down
24 changes: 15 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2327,6 +2327,13 @@ __metadata:
languageName: node
linkType: hard

"commander@npm:^9.4.0":
version: 9.4.0
resolution: "commander@npm:9.4.0"
checksum: a322de584a6ccd1ea83c24f6a660e52d16ffbe2613fcfbb8d2cc68bc9dec637492456d754fe8bb5b039ad843ed8e04fb0b107e581a75f62cde9e1a0ab1546e09
languageName: node
linkType: hard

"compare-func@npm:^2.0.0":
version: 2.0.0
resolution: "compare-func@npm:2.0.0"
Expand Down Expand Up @@ -3293,7 +3300,7 @@ __metadata:
languageName: node
linkType: hard

"glob@npm:^8.0.1, glob@npm:^8.0.3":
"glob@npm:^8.0.1":
version: 8.0.3
resolution: "glob@npm:8.0.3"
dependencies:
Expand Down Expand Up @@ -6208,7 +6215,7 @@ __metadata:
"@typescript-eslint/eslint-plugin": ^5.29.0
"@typescript-eslint/parser": ^5.29.0
colorette: ^2.0.19
commander: ^9.3.0
commander: ^9.4.0
eslint: ^8.18.0
eslint-config-prettier: ^8.5.0
eslint-plugin-prettier: ^4.0.0
Expand All @@ -6223,27 +6230,26 @@ __metadata:
pretty-quick: ^3.1.3
rimraf: ^3.0.2
ts-jest: ^28.0.5
typedoc: ^0.22.18
typedoc: ^0.23.8
typescript: ^4.7.4
bin:
typedoc-json-parser: ./dist/bin/index.js
languageName: unknown
linkType: soft

"typedoc@npm:^0.22.18":
version: 0.22.18
resolution: "typedoc@npm:0.22.18"
"typedoc@npm:^0.23.8":
version: 0.23.8
resolution: "typedoc@npm:0.23.8"
dependencies:
glob: ^8.0.3
lunr: ^2.3.9
marked: ^4.0.16
minimatch: ^5.1.0
shiki: ^0.10.1
peerDependencies:
typescript: 4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x || 4.5.x || 4.6.x || 4.7.x
typescript: 4.6.x || 4.7.x
bin:
typedoc: bin/typedoc
checksum: b813d8129682f6ed5a4e96bacaf019e4da1d2744ca89fef850d6bb4c034616567ce67e6a7f5cfc5f00aac573f0b45d44b1427aafa262ab88dce6b460cb9e744c
checksum: 99568e5df15781def0761d9876a86883bb58cb5318c258be965628626cc33737cd605640de2a9397f6722bccaed70aeb1e68c5f390b03ac7e8a17da9f091f906
languageName: node
linkType: hard

Expand Down

0 comments on commit 63d2b6f

Please sign in to comment.