mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
chore: cleanup code
This commit is contained in:
@@ -33,7 +33,6 @@ export interface SidebarLayoutProps {
|
|||||||
data: {
|
data: {
|
||||||
member: ReturnType<typeof findMember>;
|
member: ReturnType<typeof findMember>;
|
||||||
members: ReturnType<typeof getMembers>;
|
members: ReturnType<typeof getMembers>;
|
||||||
searchIndex: any[];
|
|
||||||
source: MDXRemoteSerializeResult;
|
source: MDXRemoteSerializeResult;
|
||||||
};
|
};
|
||||||
packageName: string;
|
packageName: string;
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ import { CmdKProvider } from '~/contexts/cmdK';
|
|||||||
import { MemberProvider } from '~/contexts/member';
|
import { MemberProvider } from '~/contexts/member';
|
||||||
import { PACKAGES } from '~/util/constants';
|
import { PACKAGES } from '~/util/constants';
|
||||||
import { findMember, findMemberByKey } from '~/util/model.server';
|
import { findMember, findMemberByKey } from '~/util/model.server';
|
||||||
// import { miniSearch } from '~/util/search';
|
|
||||||
|
|
||||||
export const getStaticPaths: GetStaticPaths = async () => {
|
export const getStaticPaths: GetStaticPaths = async () => {
|
||||||
const pkgs = (
|
const pkgs = (
|
||||||
@@ -193,16 +192,19 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
|
|||||||
containerKey = ApiFunction.getContainerKey(name, Number.parseInt(overloadIndex, 10));
|
containerKey = ApiFunction.getContainerKey(name, Number.parseInt(overloadIndex, 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const members = pkg
|
||||||
|
? getMembers(pkg, branchName).filter((item) => item.overloadIndex === null || item.overloadIndex <= 1)
|
||||||
|
: [];
|
||||||
|
const member =
|
||||||
|
memberName && containerKey ? findMemberByKey(model, packageName, containerKey, branchName) ?? null : null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
packageName,
|
packageName,
|
||||||
branchName,
|
branchName,
|
||||||
data: {
|
data: {
|
||||||
members: pkg
|
members,
|
||||||
? getMembers(pkg, branchName).filter((item) => item.overloadIndex === null || item.overloadIndex <= 1)
|
member,
|
||||||
: [],
|
|
||||||
member:
|
|
||||||
memberName && containerKey ? findMemberByKey(model, packageName, containerKey, branchName) ?? null : null,
|
|
||||||
source: mdxSource,
|
source: mdxSource,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import {
|
|||||||
type ApiPackage,
|
type ApiPackage,
|
||||||
type ApiItem,
|
type ApiItem,
|
||||||
ApiItemKind,
|
ApiItemKind,
|
||||||
ApiDocumentedItem,
|
|
||||||
type Excerpt,
|
type Excerpt,
|
||||||
ExcerptTokenKind,
|
ExcerptTokenKind,
|
||||||
ApiNameMixin,
|
ApiNameMixin,
|
||||||
@@ -11,6 +10,7 @@ import {
|
|||||||
type ExcerptToken,
|
type ExcerptToken,
|
||||||
type Parameter,
|
type Parameter,
|
||||||
type ApiFunction,
|
type ApiFunction,
|
||||||
|
ApiDeclaredItem,
|
||||||
} from '@microsoft/api-extractor-model';
|
} from '@microsoft/api-extractor-model';
|
||||||
import type { DocNode, DocParagraph, DocPlainText } from '@microsoft/tsdoc';
|
import type { DocNode, DocParagraph, DocPlainText } from '@microsoft/tsdoc';
|
||||||
import { type Meaning, ModuleSource } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';
|
import { type Meaning, ModuleSource } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';
|
||||||
@@ -58,8 +58,8 @@ export function generatePath(items: readonly ApiItem[], version: string) {
|
|||||||
return path.replace(/@discordjs\/(.*)\/(.*)?/, `$1/${version}/$2`);
|
return path.replace(/@discordjs\/(.*)\/(.*)?/, `$1/${version}/$2`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resolveDocComment(item: ApiDocumentedItem) {
|
export function resolveDocComment(item: ApiDeclaredItem) {
|
||||||
if (!(item instanceof ApiDocumentedItem)) {
|
if (!(item instanceof ApiDeclaredItem)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ export function createApiModel(data: any) {
|
|||||||
*
|
*
|
||||||
* @param item - The API item to resolve the summary text for.
|
* @param item - The API item to resolve the summary text for.
|
||||||
*/
|
*/
|
||||||
function tryResolveSummaryText(item: ApiDeclaredItem): string | null {
|
export function tryResolveSummaryText(item: ApiDeclaredItem): string | null {
|
||||||
if (!item.tsdocComment) {
|
if (!item.tsdocComment) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user