mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix: generateSplitDocumentation for external docs on main (#10827)
* fix: generateSplitDocumentation for external docs on main * fix: remove console.log * chore: apply suggestion Co-authored-by: Almeida <github@almeidx.dev> * fix: mixes tag * chore: docs include collection --------- Co-authored-by: Almeida <github@almeidx.dev> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user