diff --git a/packages/api-extractor/extends/tsdoc-base.json b/packages/api-extractor/extends/tsdoc-base.json index c5a78650b191..ca6520cfd49c 100644 --- a/packages/api-extractor/extends/tsdoc-base.json +++ b/packages/api-extractor/extends/tsdoc-base.json @@ -71,6 +71,7 @@ "@betaDocumentation": true, "@internalRemarks": true, + "@mixes": true, "@preapproved": true } } diff --git a/packages/builders/src/interactions/commands/chatInput/ChatInputCommand.ts b/packages/builders/src/interactions/commands/chatInput/ChatInputCommand.ts index 82cd54820716..2401678ca5eb 100644 --- a/packages/builders/src/interactions/commands/chatInput/ChatInputCommand.ts +++ b/packages/builders/src/interactions/commands/chatInput/ChatInputCommand.ts @@ -1,3 +1,4 @@ +/* eslint-disable jsdoc/valid-types */ import { ApplicationCommandType, type RESTPostAPIChatInputApplicationCommandsJSONBody } from 'discord-api-types/v10'; import { Mixin } from 'ts-mixer'; import { validate } from '../../../util/validation.js'; @@ -10,10 +11,10 @@ import { SharedChatInputCommandSubcommands } from './mixins/SharedSubcommands.js /** * A builder that creates API-compatible JSON data for chat input commands. * - * @mixes CommandBuilder - * @mixes SharedChatInputCommandOptions - * @mixes SharedNameAndDescription - * @mixes SharedChatInputCommandSubcommands + * @mixes {@link CommandBuilder}\<{@link discord-api-types/v10#(RESTPostAPIChatInputApplicationCommandsJSONBody:interface)}\> + * @mixes {@link SharedChatInputCommandOptions} + * @mixes {@link SharedNameAndDescription} + * @mixes {@link SharedChatInputCommandSubcommands} */ export class ChatInputCommandBuilder extends Mixin( CommandBuilder, diff --git a/packages/builders/tsdoc.json b/packages/builders/tsdoc.json index 92aaafe6f6db..e191d552933c 100644 --- a/packages/builders/tsdoc.json +++ b/packages/builders/tsdoc.json @@ -1,9 +1,4 @@ { "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", - "tagDefinitions": [ - { - "tagName": "@mixes", - "syntaxKind": "block" - } - ] + "extends": ["@discordjs/api-extractor/extends/tsdoc-base.json"] } diff --git a/packages/discord.js/api-extractor.json b/packages/discord.js/api-extractor.json index 0e5a315890ed..15528fc8dac7 100644 --- a/packages/discord.js/api-extractor.json +++ b/packages/discord.js/api-extractor.json @@ -4,6 +4,7 @@ "bundledPackages": [ "discord-api-types", "@discordjs/builders", + "@discordjs/collection", "@discordjs/formatters", "@discordjs/rest", "@discordjs/util", diff --git a/packages/scripts/src/generateSplitDocumentation.ts b/packages/scripts/src/generateSplitDocumentation.ts index 703d24116edd..12905293fee7 100644 --- a/packages/scripts/src/generateSplitDocumentation.ts +++ b/packages/scripts/src/generateSplitDocumentation.ts @@ -457,13 +457,15 @@ function itemTsDoc(item: DocNode, apiItem: ApiItem) { const comment = node as DocComment; const exampleBlocks = comment.customBlocks.filter( - (block) => block.blockTag.tagName.toUpperCase() === StandardTags.example.tagNameWithUpperCase, + (block) => block.blockTag.tagNameWithUpperCase === StandardTags.example.tagNameWithUpperCase, ); const defaultValueBlock = comment.customBlocks.find( - (block) => block.blockTag.tagName.toUpperCase() === StandardTags.defaultValue.tagNameWithUpperCase, + (block) => block.blockTag.tagNameWithUpperCase === StandardTags.defaultValue.tagNameWithUpperCase, ); + const mixesBlocks = comment.customBlocks.filter((block) => block.blockTag.tagNameWithUpperCase === '@MIXES'); + return { kind: DocNodeKind.Comment, deprecatedBlock: comment.deprecatedBlock @@ -497,6 +499,9 @@ function itemTsDoc(item: DocNode, apiItem: ApiItem) { seeBlocks: comment.seeBlocks .flatMap((block) => createNode(block.content).flat(1)) .filter((val: any) => val.kind !== DocNodeKind.SoftBreak), + mixesBlocks: mixesBlocks + .flatMap((block) => createNode(block.content).flat(1)) + .filter((val: any) => val.kind !== DocNodeKind.SoftBreak), }; } @@ -522,8 +527,7 @@ function itemInfo(item: ApiDeclaredItem) { const isAbstract = ApiAbstractMixin.isBaseClassOf(item) && item.isAbstract; const isOptional = ApiOptionalMixin.isBaseClassOf(item) && item.isOptional; const isDeprecated = Boolean(item.tsdocComment?.deprecatedBlock); - const isExternal = Boolean(item.sourceLocation.fileUrl?.includes('node_modules')); - + const isExternal = Boolean(sourceLine === undefined); const hasSummary = Boolean(item.tsdocComment?.summarySection); return { @@ -587,6 +591,19 @@ function resolveFileUrl(item: ApiDeclaredItem) { sourceURL: href, }; } + } else if (fileUrl?.includes('/dist/') && fileUrl.includes('/main/packages/')) { + const [, pkg] = fileUrl.split('/main/packages/'); + const pkgName = pkg!.split('/')[0]; + const version = 'main'; + + // https://github.com/discordjs/discord.js/tree/main/packages/builders/dist/index.d.ts + let currentItem = item; + while (currentItem.parent && currentItem.parent.kind !== ApiItemKind.EntryPoint) + currentItem = currentItem.parent as ApiDeclaredItem; + + return { + sourceURL: `/docs/packages/${pkgName}/${version}/${currentItem.displayName}:${currentItem.kind}`, + }; } return {