mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
feat: add util package for generating search indices (#8571)
This commit is contained in:
7
packages/api-extractor-utils/.eslintrc.json
Normal file
7
packages/api-extractor-utils/.eslintrc.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../.eslintrc.json",
|
||||||
|
"plugins": ["eslint-plugin-tsdoc"],
|
||||||
|
"rules": {
|
||||||
|
"tsdoc/syntax": "warn"
|
||||||
|
}
|
||||||
|
}
|
||||||
27
packages/api-extractor-utils/.gitignore
vendored
Normal file
27
packages/api-extractor-utils/.gitignore
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# Packages
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Log files
|
||||||
|
logs/
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
|
||||||
|
# Env
|
||||||
|
.env
|
||||||
|
|
||||||
|
# Dist
|
||||||
|
dist/
|
||||||
|
typings/
|
||||||
|
docs/**/*
|
||||||
|
!docs/index.json
|
||||||
|
!docs/README.md
|
||||||
|
|
||||||
|
# Miscellaneous
|
||||||
|
.tmp/
|
||||||
|
coverage/
|
||||||
|
tsconfig.tsbuildinfo
|
||||||
1
packages/api-extractor-utils/.lintstagedrc.js
Normal file
1
packages/api-extractor-utils/.lintstagedrc.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
module.exports = require('../../.lintstagedrc.json');
|
||||||
8
packages/api-extractor-utils/.prettierignore
Normal file
8
packages/api-extractor-utils/.prettierignore
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# Autogenerated
|
||||||
|
CHANGELOG.md
|
||||||
|
.turbo
|
||||||
|
dist/
|
||||||
|
docs/**/*
|
||||||
|
!docs/index.yml
|
||||||
|
!docs/README.md
|
||||||
|
coverage/
|
||||||
65
packages/api-extractor-utils/package.json
Normal file
65
packages/api-extractor-utils/package.json
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
{
|
||||||
|
"name": "@discordjs/api-extractor-utils",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Utilities for api-extractor",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"build": "unbuild",
|
||||||
|
"lint": "prettier --check . && TIMING=1 eslint src --ext mjs,js,ts",
|
||||||
|
"format": "prettier --write . && TIMING=1 eslint src --ext mjs,js,ts --fix",
|
||||||
|
"fmt": "yarn format"
|
||||||
|
},
|
||||||
|
"main": "./dist/index.cjs",
|
||||||
|
"module": "./dist/index.mjs",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
"import": "./dist/index.mjs",
|
||||||
|
"require": "./dist/index.cjs",
|
||||||
|
"types": "./dist/index.d.ts"
|
||||||
|
},
|
||||||
|
"directories": {
|
||||||
|
"lib": "src",
|
||||||
|
"test": "__tests__"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"contributors": [
|
||||||
|
"Suneet Tipirneni <suneettipirneni@icloud.com>"
|
||||||
|
],
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/discordjs/discord.js.git"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/discordjs/discord.js/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://discord.js.org",
|
||||||
|
"dependencies": {
|
||||||
|
"@microsoft/api-extractor-model": "^7.23.3",
|
||||||
|
"@microsoft/tsdoc": "^0.14.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@favware/cliff-jumper": "^1.8.7",
|
||||||
|
"@types/node": "^16.11.54",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^5.34.0",
|
||||||
|
"@typescript-eslint/parser": "^5.34.0",
|
||||||
|
"eslint": "^8.22.0",
|
||||||
|
"eslint-config-marine": "^9.4.1",
|
||||||
|
"eslint-config-prettier": "^8.5.0",
|
||||||
|
"eslint-import-resolver-typescript": "^3.5.0",
|
||||||
|
"eslint-plugin-import": "^2.26.0",
|
||||||
|
"eslint-plugin-tsdoc": "^0.2.16",
|
||||||
|
"prettier": "^2.7.1",
|
||||||
|
"rollup-plugin-typescript2": "^0.33.0",
|
||||||
|
"typescript": "^4.7.4",
|
||||||
|
"unbuild": "^0.8.9"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16.9.0"
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,20 +18,12 @@ import {
|
|||||||
type ApiConstructor,
|
type ApiConstructor,
|
||||||
type ApiItemContainerMixin,
|
type ApiItemContainerMixin,
|
||||||
} from '@microsoft/api-extractor-model';
|
} from '@microsoft/api-extractor-model';
|
||||||
import { generateTypeParamData } from './TypeParameterMixin';
|
import { generateTypeParamData } from './TypeParameterJSONEncoder';
|
||||||
import { Visibility } from './Visibility';
|
import { type TokenDocumentation, resolveName, genReference, genToken, genParameter, generatePath } from './parse';
|
||||||
import { createCommentNode } from './comment';
|
import { createCommentNode } from './tsdoc';
|
||||||
import type { DocBlockJSON } from './comment/CommentBlock';
|
import type { DocBlockJSON } from './tsdoc/CommentBlock';
|
||||||
import type { AnyDocNodeJSON } from './comment/CommentNode';
|
import type { AnyDocNodeJSON } from './tsdoc/CommentNode';
|
||||||
import { type DocNodeContainerJSON, nodeContainer } from './comment/CommentNodeContainer';
|
import { type DocNodeContainerJSON, nodeContainer } from './tsdoc/CommentNodeContainer';
|
||||||
import {
|
|
||||||
generatePath,
|
|
||||||
genParameter,
|
|
||||||
genReference,
|
|
||||||
genToken,
|
|
||||||
resolveName,
|
|
||||||
type TokenDocumentation,
|
|
||||||
} from '~/util/parse.server';
|
|
||||||
|
|
||||||
export interface ReferenceData {
|
export interface ReferenceData {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -96,7 +88,7 @@ export interface ApiMethodSignatureJSON
|
|||||||
|
|
||||||
export interface ApiMethodJSON extends ApiMethodSignatureJSON {
|
export interface ApiMethodJSON extends ApiMethodSignatureJSON {
|
||||||
static: boolean;
|
static: boolean;
|
||||||
visibility: Visibility;
|
protected: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ApiParameterJSON {
|
export interface ApiParameterJSON {
|
||||||
@@ -293,7 +285,7 @@ export class ApiNodeJSONEncoder {
|
|||||||
return {
|
return {
|
||||||
...this.encodeMethodSignature(model, item, parent, version),
|
...this.encodeMethodSignature(model, item, parent, version),
|
||||||
static: item.isStatic,
|
static: item.isStatic,
|
||||||
visibility: item.isProtected ? Visibility.Protected : Visibility.Public,
|
protected: item.isProtected,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { ApiItem, ApiModel, TypeParameter } from '@microsoft/api-extractor-model';
|
import type { TypeParameter, ApiModel, ApiItem } from '@microsoft/api-extractor-model';
|
||||||
import { block, type DocBlockJSON } from './comment/CommentBlock';
|
import { type TokenDocumentation, genToken } from './parse';
|
||||||
import { genToken, type TokenDocumentation } from '~/util/parse.server';
|
import { type DocBlockJSON, block } from './tsdoc/CommentBlock';
|
||||||
|
|
||||||
export interface TypeParameterData {
|
export interface TypeParameterData {
|
||||||
name: string;
|
name: string;
|
||||||
4
packages/api-extractor-utils/src/index.ts
Normal file
4
packages/api-extractor-utils/src/index.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export * from './ApiNodeJSONEncoder';
|
||||||
|
export * from './parse';
|
||||||
|
export * from './tsdoc';
|
||||||
|
export * from './TypeParameterJSONEncoder';
|
||||||
@@ -14,8 +14,8 @@ import {
|
|||||||
} 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';
|
||||||
import { createCommentNode } from '~/DocModel/comment';
|
import { createCommentNode } from './tsdoc';
|
||||||
import type { DocBlockJSON } from '~/DocModel/comment/CommentBlock';
|
import type { DocBlockJSON } from './tsdoc/CommentBlock';
|
||||||
|
|
||||||
export function findPackage(model: ApiModel, name: string): ApiPackage | undefined {
|
export function findPackage(model: ApiModel, name: string): ApiPackage | undefined {
|
||||||
return (model.findMembersByName(name)[0] ?? model.findMembersByName(`@discordjs/${name}`)[0]) as
|
return (model.findMembersByName(name)[0] ?? model.findMembersByName(`@discordjs/${name}`)[0]) as
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { ApiItem, ApiModel } from '@microsoft/api-extractor-model';
|
import type { ApiItem, ApiModel } from '@microsoft/api-extractor-model';
|
||||||
import type { DocDeclarationReference, DocLinkTag } from '@microsoft/tsdoc';
|
import type { DocDeclarationReference, DocLinkTag } from '@microsoft/tsdoc';
|
||||||
import { type DocNodeJSON, node } from './CommentNode';
|
import { type DocNodeJSON, node } from './CommentNode';
|
||||||
import { generatePath, resolveName } from '~/util/parse.server';
|
import { resolveName, generatePath } from '../parse';
|
||||||
|
|
||||||
interface LinkTagCodeLink {
|
interface LinkTagCodeLink {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -15,7 +15,7 @@ export interface DocLinkTagJSON extends DocNodeJSON {
|
|||||||
urlDestination: string | null;
|
urlDestination: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function genToken(
|
export function genLinkToken(
|
||||||
model: ApiModel,
|
model: ApiModel,
|
||||||
ref: DocDeclarationReference,
|
ref: DocDeclarationReference,
|
||||||
context: ApiItem | null,
|
context: ApiItem | null,
|
||||||
@@ -46,7 +46,7 @@ export function linkTagNode(
|
|||||||
: null;
|
: null;
|
||||||
|
|
||||||
const codeDestination = linkNode.codeDestination
|
const codeDestination = linkNode.codeDestination
|
||||||
? genToken(model, linkNode.codeDestination, parentItem ?? packageEntryPoint ?? null, version)
|
? genLinkToken(model, linkNode.codeDestination, parentItem ?? packageEntryPoint ?? null, version)
|
||||||
: null;
|
: null;
|
||||||
const text = linkNode.linkText ?? null;
|
const text = linkNode.linkText ?? null;
|
||||||
const urlDestination = linkNode.urlDestination ?? null;
|
const urlDestination = linkNode.urlDestination ?? null;
|
||||||
@@ -50,3 +50,14 @@ export function createCommentNode(
|
|||||||
return _node(node);
|
return _node(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export * from './CommentNode';
|
||||||
|
export * from './CommentNodeContainer';
|
||||||
|
export * from './CommentBlock';
|
||||||
|
export * from './CommentBlockTag';
|
||||||
|
export * from './CommentCodeSpan';
|
||||||
|
export * from './FencedCodeCommentNode';
|
||||||
|
export * from './LinkTagCommentNode';
|
||||||
|
export * from './ParamBlock';
|
||||||
|
export * from './PlainTextCommentNode';
|
||||||
|
export * from './RootComment';
|
||||||
20
packages/api-extractor-utils/tsconfig.eslint.json
Normal file
20
packages/api-extractor-utils/tsconfig.eslint.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"allowJs": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"**/*.ts",
|
||||||
|
"**/*.tsx",
|
||||||
|
"**/*.js",
|
||||||
|
"**/*.mjs",
|
||||||
|
"**/*.jsx",
|
||||||
|
"**/*.test.ts",
|
||||||
|
"**/*.test.js",
|
||||||
|
"**/*.test.mjs",
|
||||||
|
"**/*.spec.ts",
|
||||||
|
"**/*.spec.js",
|
||||||
|
"**/*.spec.mjs"
|
||||||
|
],
|
||||||
|
"exclude": []
|
||||||
|
}
|
||||||
8
packages/api-extractor-utils/tsconfig.json
Normal file
8
packages/api-extractor-utils/tsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"skipDefaultLibCheck": true,
|
||||||
|
"skipLibCheck": true
|
||||||
|
},
|
||||||
|
"include": ["src/**/*.ts"]
|
||||||
|
}
|
||||||
2
packages/scripts/.gitignore
vendored
2
packages/scripts/.gitignore
vendored
@@ -23,3 +23,5 @@ docs/**/*
|
|||||||
# Miscellaneous
|
# Miscellaneous
|
||||||
.tmp/
|
.tmp/
|
||||||
coverage/
|
coverage/
|
||||||
|
|
||||||
|
searchIndex/
|
||||||
@@ -4,7 +4,6 @@
|
|||||||
"description": "A set of scripts that we use for our workflows",
|
"description": "A set of scripts that we use for our workflows",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "vitest run",
|
|
||||||
"build": "unbuild",
|
"build": "unbuild",
|
||||||
"lint": "prettier --check . && TIMING=1 eslint src --ext mjs,js,ts",
|
"lint": "prettier --check . && TIMING=1 eslint src --ext mjs,js,ts",
|
||||||
"format": "prettier --write . && TIMING=1 eslint src --ext mjs,js,ts --fix",
|
"format": "prettier --write . && TIMING=1 eslint src --ext mjs,js,ts --fix",
|
||||||
@@ -44,6 +43,9 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://discord.js.org",
|
"homepage": "https://discord.js.org",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@discordjs/api-extractor-utils": "workspace:^",
|
||||||
|
"@microsoft/api-extractor-model": "^7.23.3",
|
||||||
|
"@microsoft/tsdoc": "^0.14.1",
|
||||||
"commander": "^9.4.0",
|
"commander": "^9.4.0",
|
||||||
"tslib": "^2.4.0"
|
"tslib": "^2.4.0"
|
||||||
},
|
},
|
||||||
|
|||||||
91
packages/scripts/src/generateIndex.ts
Normal file
91
packages/scripts/src/generateIndex.ts
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
import fs from 'node:fs/promises';
|
||||||
|
import path from 'node:path';
|
||||||
|
import { generatePath } from '@discordjs/api-extractor-utils';
|
||||||
|
import { ApiDeclaredItem, ApiItem, ApiItemContainerMixin, ApiModel } from '@microsoft/api-extractor-model';
|
||||||
|
import { DocCodeSpan, DocNode, DocNodeKind, DocParagraph, DocPlainText } from '@microsoft/tsdoc';
|
||||||
|
|
||||||
|
export interface MemberJSON {
|
||||||
|
name: string;
|
||||||
|
kind: string;
|
||||||
|
summary: string | null;
|
||||||
|
path: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to resolve the summary text for the given item.
|
||||||
|
* @param item - The API item to resolve the summary text for.
|
||||||
|
*/
|
||||||
|
function tryResolveSummaryText(item: ApiDeclaredItem): string | null {
|
||||||
|
if (!item.tsdocComment) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { summarySection } = item.tsdocComment;
|
||||||
|
|
||||||
|
let retVal = '';
|
||||||
|
|
||||||
|
// Recursively visit the nodes in the summary section.
|
||||||
|
const visitTSDocNode = (node: DocNode) => {
|
||||||
|
switch (node.kind) {
|
||||||
|
case DocNodeKind.CodeSpan:
|
||||||
|
retVal += (node as DocCodeSpan).code;
|
||||||
|
break;
|
||||||
|
case DocNodeKind.PlainText:
|
||||||
|
retVal += (node as DocPlainText).text;
|
||||||
|
break;
|
||||||
|
case DocNodeKind.Section:
|
||||||
|
case DocNodeKind.Paragraph:
|
||||||
|
return (node as DocParagraph).nodes.forEach(visitTSDocNode);
|
||||||
|
default: // We'll ignore all other nodes.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const node of summarySection.nodes) {
|
||||||
|
visitTSDocNode(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (retVal === '') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function visitNodes(item: ApiItem, tag: string) {
|
||||||
|
const members: MemberJSON[] = [];
|
||||||
|
|
||||||
|
for (const member of item.members) {
|
||||||
|
if (!(member instanceof ApiDeclaredItem)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ApiItemContainerMixin.isBaseClassOf(member)) {
|
||||||
|
members.push(...visitNodes(member, tag));
|
||||||
|
}
|
||||||
|
|
||||||
|
members.push({
|
||||||
|
name: member.displayName,
|
||||||
|
kind: member.kind,
|
||||||
|
summary: tryResolveSummaryText(member),
|
||||||
|
path: generatePath(member.getHierarchy(), tag),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return members;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function generateIndex(model: ApiModel, packageName: string, tag: string) {
|
||||||
|
const members = visitNodes(model, tag);
|
||||||
|
|
||||||
|
const dir = 'searchIndex';
|
||||||
|
|
||||||
|
if (!(await fs.stat(dir)).isDirectory()) {
|
||||||
|
await fs.mkdir(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
await fs.writeFile(
|
||||||
|
path.join('searchIndex', `${packageName}-${tag}-doc-index.json`),
|
||||||
|
JSON.stringify(members, undefined, 2),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1 +1 @@
|
|||||||
export {};
|
export * from './generateIndex';
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://discord.js.org",
|
"homepage": "https://discord.js.org",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@discordjs/api-extractor-utils": "workspace:^",
|
||||||
"@emotion/react": "^11.10.0",
|
"@emotion/react": "^11.10.0",
|
||||||
"@emotion/server": "^11.10.0",
|
"@emotion/server": "^11.10.0",
|
||||||
"@mantine/core": "^5.2.3",
|
"@mantine/core": "^5.2.3",
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
export enum Visibility {
|
|
||||||
Public,
|
|
||||||
Protected,
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import type { TokenDocumentation, ApiItemJSON, AnyDocNodeJSON, InheritanceData } from '@discordjs/api-extractor-utils';
|
||||||
import { ActionIcon, Badge, Box, createStyles, Group, MediaQuery, Stack, Title } from '@mantine/core';
|
import { ActionIcon, Badge, Box, createStyles, Group, MediaQuery, Stack, Title } from '@mantine/core';
|
||||||
import { useMediaQuery } from '@mantine/hooks';
|
import { useMediaQuery } from '@mantine/hooks';
|
||||||
import type { PropsWithChildren } from 'react';
|
import type { PropsWithChildren } from 'react';
|
||||||
@@ -5,9 +6,6 @@ import { FiLink } from 'react-icons/fi';
|
|||||||
import { HyperlinkedText } from './HyperlinkedText';
|
import { HyperlinkedText } from './HyperlinkedText';
|
||||||
import { InheritanceText } from './InheritanceText';
|
import { InheritanceText } from './InheritanceText';
|
||||||
import { TSDoc } from './tsdoc/TSDoc';
|
import { TSDoc } from './tsdoc/TSDoc';
|
||||||
import type { ApiItemJSON, InheritanceData } from '~/DocModel/ApiNodeJSONEncoder';
|
|
||||||
import type { AnyDocNodeJSON } from '~/DocModel/comment/CommentNode';
|
|
||||||
import type { TokenDocumentation } from '~/util/parse.server';
|
|
||||||
|
|
||||||
export enum CodeListingSeparatorType {
|
export enum CodeListingSeparatorType {
|
||||||
Type = ':',
|
Type = ':',
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
import type {
|
||||||
|
ApiItemJSON,
|
||||||
|
TokenDocumentation,
|
||||||
|
TypeParameterData,
|
||||||
|
AnyDocNodeJSON,
|
||||||
|
ApiClassJSON,
|
||||||
|
ApiInterfaceJSON,
|
||||||
|
} from '@discordjs/api-extractor-utils';
|
||||||
import {
|
import {
|
||||||
Group,
|
Group,
|
||||||
Stack,
|
Stack,
|
||||||
@@ -30,10 +38,6 @@ import { Section } from './Section';
|
|||||||
import { TableOfContentItems } from './TableOfContentItems';
|
import { TableOfContentItems } from './TableOfContentItems';
|
||||||
import { TypeParamTable } from './TypeParamTable';
|
import { TypeParamTable } from './TypeParamTable';
|
||||||
import { TSDoc } from './tsdoc/TSDoc';
|
import { TSDoc } from './tsdoc/TSDoc';
|
||||||
import type { ApiClassJSON, ApiInterfaceJSON, ApiItemJSON } from '~/DocModel/ApiNodeJSONEncoder';
|
|
||||||
import type { TypeParameterData } from '~/DocModel/TypeParameterMixin';
|
|
||||||
import type { AnyDocNodeJSON } from '~/DocModel/comment/CommentNode';
|
|
||||||
import type { TokenDocumentation } from '~/util/parse.server';
|
|
||||||
|
|
||||||
type DocContainerProps = PropsWithChildren<{
|
type DocContainerProps = PropsWithChildren<{
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import type { TokenDocumentation } from '@discordjs/api-extractor-utils';
|
||||||
import { Anchor, Text } from '@mantine/core';
|
import { Anchor, Text } from '@mantine/core';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import type { TokenDocumentation } from '~/util/parse.server';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a hyperlinked html node based on token type references
|
* Constructs a hyperlinked html node based on token type references
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import type { InheritanceData } from '@discordjs/api-extractor-utils';
|
||||||
import { Anchor, Text } from '@mantine/core';
|
import { Anchor, Text } from '@mantine/core';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import type { InheritanceData } from '~/DocModel/ApiNodeJSONEncoder';
|
|
||||||
|
|
||||||
export function InheritanceText({ data }: { data: InheritanceData }) {
|
export function InheritanceText({ data }: { data: InheritanceData }) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import type { ApiMethodJSON, ApiMethodSignatureJSON } from '@discordjs/api-extractor-utils';
|
||||||
import { ActionIcon, Badge, Box, createStyles, Group, MediaQuery, Stack, Title } from '@mantine/core';
|
import { ActionIcon, Badge, Box, createStyles, Group, MediaQuery, Stack, Title } from '@mantine/core';
|
||||||
import { useMediaQuery } from '@mantine/hooks';
|
import { useMediaQuery } from '@mantine/hooks';
|
||||||
import { FiLink } from 'react-icons/fi';
|
import { FiLink } from 'react-icons/fi';
|
||||||
@@ -5,8 +6,6 @@ import { HyperlinkedText } from './HyperlinkedText';
|
|||||||
import { InheritanceText } from './InheritanceText';
|
import { InheritanceText } from './InheritanceText';
|
||||||
import { ParameterTable } from './ParameterTable';
|
import { ParameterTable } from './ParameterTable';
|
||||||
import { TSDoc } from './tsdoc/TSDoc';
|
import { TSDoc } from './tsdoc/TSDoc';
|
||||||
import type { ApiMethodJSON, ApiMethodSignatureJSON } from '~/DocModel/ApiNodeJSONEncoder';
|
|
||||||
import { Visibility } from '~/DocModel/Visibility';
|
|
||||||
|
|
||||||
const useStyles = createStyles((theme) => ({
|
const useStyles = createStyles((theme) => ({
|
||||||
outer: {
|
outer: {
|
||||||
@@ -48,7 +47,7 @@ export function MethodItem({ data }: { data: ApiMethodJSON | ApiMethodSignatureJ
|
|||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
</MediaQuery>
|
</MediaQuery>
|
||||||
{data.deprecated ||
|
{data.deprecated ||
|
||||||
(data.kind === 'Method' && method.visibility === Visibility.Protected) ||
|
(data.kind === 'Method' && method.protected) ||
|
||||||
(data.kind === 'Method' && method.static) ? (
|
(data.kind === 'Method' && method.static) ? (
|
||||||
<Group spacing={10} noWrap>
|
<Group spacing={10} noWrap>
|
||||||
{data.deprecated ? (
|
{data.deprecated ? (
|
||||||
@@ -56,9 +55,7 @@ export function MethodItem({ data }: { data: ApiMethodJSON | ApiMethodSignatureJ
|
|||||||
Deprecated
|
Deprecated
|
||||||
</Badge>
|
</Badge>
|
||||||
) : null}
|
) : null}
|
||||||
{data.kind === 'Method' && method.visibility === Visibility.Protected ? (
|
{data.kind === 'Method' && method.protected ? <Badge variant="filled">Protected</Badge> : null}
|
||||||
<Badge variant="filled">Protected</Badge>
|
|
||||||
) : null}
|
|
||||||
{data.kind === 'Method' && method.static ? <Badge variant="filled">Static</Badge> : null}
|
{data.kind === 'Method' && method.static ? <Badge variant="filled">Static</Badge> : null}
|
||||||
</Group>
|
</Group>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import type { ApiMethodJSON, ApiMethodSignatureJSON } from '@discordjs/api-extractor-utils';
|
||||||
import { Divider, Stack } from '@mantine/core';
|
import { Divider, Stack } from '@mantine/core';
|
||||||
import { Fragment } from 'react';
|
import { Fragment } from 'react';
|
||||||
import { MethodItem } from './MethodItem';
|
import { MethodItem } from './MethodItem';
|
||||||
import type { ApiMethodJSON, ApiMethodSignatureJSON } from '~/DocModel/ApiNodeJSONEncoder';
|
|
||||||
|
|
||||||
export function MethodList({ data }: { data: (ApiMethodJSON | ApiMethodSignatureJSON)[] }) {
|
export function MethodList({ data }: { data: (ApiMethodJSON | ApiMethodSignatureJSON)[] }) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import type { ParameterDocumentation } from '@discordjs/api-extractor-utils';
|
||||||
import { Box, ScrollArea } from '@mantine/core';
|
import { Box, ScrollArea } from '@mantine/core';
|
||||||
import { HyperlinkedText } from './HyperlinkedText';
|
import { HyperlinkedText } from './HyperlinkedText';
|
||||||
import { Table } from './Table';
|
import { Table } from './Table';
|
||||||
import { TSDoc } from './tsdoc/TSDoc';
|
import { TSDoc } from './tsdoc/TSDoc';
|
||||||
import type { ParameterDocumentation } from '~/util/parse.server';
|
|
||||||
|
|
||||||
const columnStyles = {
|
const columnStyles = {
|
||||||
Name: 'font-mono whitespace-nowrap',
|
Name: 'font-mono whitespace-nowrap',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import type { ApiPropertyItemJSON } from '@discordjs/api-extractor-utils';
|
||||||
import { Stack } from '@mantine/core';
|
import { Stack } from '@mantine/core';
|
||||||
import { CodeListing } from './CodeListing';
|
import { CodeListing } from './CodeListing';
|
||||||
import type { ApiPropertyItemJSON } from '~/DocModel/ApiNodeJSONEncoder';
|
|
||||||
|
|
||||||
export function PropertyList({ data }: { data: ApiPropertyItemJSON[] }) {
|
export function PropertyList({ data }: { data: ApiPropertyItemJSON[] }) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
import type {
|
||||||
|
ApiClassJSON,
|
||||||
|
ApiInterfaceJSON,
|
||||||
|
ParameterDocumentation,
|
||||||
|
ApiConstructorJSON,
|
||||||
|
} from '@discordjs/api-extractor-utils';
|
||||||
import { Stack, Group, Badge, Title } from '@mantine/core';
|
import { Stack, Group, Badge, Title } from '@mantine/core';
|
||||||
import { useMediaQuery } from '@mantine/hooks';
|
import { useMediaQuery } from '@mantine/hooks';
|
||||||
import { VscSymbolConstant, VscSymbolMethod, VscSymbolProperty } from 'react-icons/vsc';
|
import { VscSymbolConstant, VscSymbolMethod, VscSymbolProperty } from 'react-icons/vsc';
|
||||||
@@ -6,8 +12,6 @@ import { ParameterTable } from './ParameterTable';
|
|||||||
import { PropertyList } from './PropertyList';
|
import { PropertyList } from './PropertyList';
|
||||||
import { Section } from './Section';
|
import { Section } from './Section';
|
||||||
import { TSDoc } from './tsdoc/TSDoc';
|
import { TSDoc } from './tsdoc/TSDoc';
|
||||||
import type { ApiClassJSON, ApiConstructorJSON, ApiInterfaceJSON } from '~/DocModel/ApiNodeJSONEncoder';
|
|
||||||
import type { ParameterDocumentation } from '~/util/parse.server';
|
|
||||||
|
|
||||||
export function PropertiesSection({ data }: { data: ApiClassJSON['properties'] | ApiInterfaceJSON['properties'] }) {
|
export function PropertiesSection({ data }: { data: ApiClassJSON['properties'] | ApiInterfaceJSON['properties'] }) {
|
||||||
const matches = useMediaQuery('(max-width: 768px)');
|
const matches = useMediaQuery('(max-width: 768px)');
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import type { getMembers, ApiItemJSON } from '@discordjs/api-extractor-utils';
|
||||||
import {
|
import {
|
||||||
useMantineTheme,
|
useMantineTheme,
|
||||||
AppShell,
|
AppShell,
|
||||||
@@ -33,10 +34,8 @@ import { VscChevronDown, VscGithubInverted, VscPackage, VscVersions } from 'reac
|
|||||||
import { WiDaySunny, WiNightClear } from 'react-icons/wi';
|
import { WiDaySunny, WiNightClear } from 'react-icons/wi';
|
||||||
import useSWR from 'swr';
|
import useSWR from 'swr';
|
||||||
import { SidebarItems } from './SidebarItems';
|
import { SidebarItems } from './SidebarItems';
|
||||||
import type { ApiItemJSON } from '~/DocModel/ApiNodeJSONEncoder';
|
|
||||||
import type { findMember } from '~/util/model.server';
|
import type { findMember } from '~/util/model.server';
|
||||||
import { PACKAGES } from '~/util/packages';
|
import { PACKAGES } from '~/util/packages';
|
||||||
import type { getMembers } from '~/util/parse.server';
|
|
||||||
|
|
||||||
const fetcher = (url: string) => fetch(url).then((res) => res.json());
|
const fetcher = (url: string) => fetch(url).then((res) => res.json());
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import type { ApiClassJSON, ApiInterfaceJSON } from '@discordjs/api-extractor-utils';
|
||||||
import { createStyles, Group, Text, Box, Stack, ThemeIcon, useMantineColorScheme } from '@mantine/core';
|
import { createStyles, Group, Text, Box, Stack, ThemeIcon, useMantineColorScheme } from '@mantine/core';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { VscListSelection, VscSymbolMethod, VscSymbolProperty } from 'react-icons/vsc';
|
import { VscListSelection, VscSymbolMethod, VscSymbolProperty } from 'react-icons/vsc';
|
||||||
import type { ApiClassJSON, ApiInterfaceJSON } from '~/DocModel/ApiNodeJSONEncoder';
|
|
||||||
|
|
||||||
const useStyles = createStyles((theme) => ({
|
const useStyles = createStyles((theme) => ({
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import type { TypeParameterData } from '@discordjs/api-extractor-utils';
|
||||||
import { ScrollArea } from '@mantine/core';
|
import { ScrollArea } from '@mantine/core';
|
||||||
import { HyperlinkedText } from './HyperlinkedText';
|
import { HyperlinkedText } from './HyperlinkedText';
|
||||||
import { Table } from './Table';
|
import { Table } from './Table';
|
||||||
import { TSDoc } from './tsdoc/TSDoc';
|
import { TSDoc } from './tsdoc/TSDoc';
|
||||||
import type { TypeParameterData } from '~/DocModel/TypeParameterMixin';
|
|
||||||
|
|
||||||
const rowElements = {
|
const rowElements = {
|
||||||
Name: 'font-mono whitespace-nowrap',
|
Name: 'font-mono whitespace-nowrap',
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import type { ApiClassJSON } from '@discordjs/api-extractor-utils';
|
||||||
import { Skeleton } from '@mantine/core';
|
import { Skeleton } from '@mantine/core';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { DocContainer } from '../DocContainer';
|
import { DocContainer } from '../DocContainer';
|
||||||
import { ConstructorSection, MethodsSection, PropertiesSection } from '../Sections';
|
import { ConstructorSection, MethodsSection, PropertiesSection } from '../Sections';
|
||||||
import type { ApiClassJSON } from '~/DocModel/ApiNodeJSONEncoder';
|
|
||||||
|
|
||||||
export function Class({ data }: { data: ApiClassJSON }) {
|
export function Class({ data }: { data: ApiClassJSON }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import type { ApiEnumJSON } from '@discordjs/api-extractor-utils';
|
||||||
import { Skeleton, Stack } from '@mantine/core';
|
import { Skeleton, Stack } from '@mantine/core';
|
||||||
import { useMediaQuery } from '@mantine/hooks';
|
import { useMediaQuery } from '@mantine/hooks';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
@@ -5,7 +6,6 @@ import { VscSymbolEnumMember } from 'react-icons/vsc';
|
|||||||
import { CodeListing, CodeListingSeparatorType } from '../CodeListing';
|
import { CodeListing, CodeListingSeparatorType } from '../CodeListing';
|
||||||
import { DocContainer } from '../DocContainer';
|
import { DocContainer } from '../DocContainer';
|
||||||
import { Section } from '../Section';
|
import { Section } from '../Section';
|
||||||
import type { ApiEnumJSON } from '~/DocModel/ApiNodeJSONEncoder';
|
|
||||||
|
|
||||||
export function Enum({ data }: { data: ApiEnumJSON }) {
|
export function Enum({ data }: { data: ApiEnumJSON }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import type { ApiFunctionJSON } from '@discordjs/api-extractor-utils';
|
||||||
import { Skeleton } from '@mantine/core';
|
import { Skeleton } from '@mantine/core';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { DocContainer } from '../DocContainer';
|
import { DocContainer } from '../DocContainer';
|
||||||
import { ParametersSection } from '../Sections';
|
import { ParametersSection } from '../Sections';
|
||||||
import type { ApiFunctionJSON } from '~/DocModel/ApiNodeJSONEncoder';
|
|
||||||
|
|
||||||
export function Function({ data }: { data: ApiFunctionJSON }) {
|
export function Function({ data }: { data: ApiFunctionJSON }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import type { ApiInterfaceJSON } from '@discordjs/api-extractor-utils';
|
||||||
import { Skeleton } from '@mantine/core';
|
import { Skeleton } from '@mantine/core';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { DocContainer } from '../DocContainer';
|
import { DocContainer } from '../DocContainer';
|
||||||
import { MethodsSection, PropertiesSection } from '../Sections';
|
import { MethodsSection, PropertiesSection } from '../Sections';
|
||||||
import type { ApiInterfaceJSON } from '~/DocModel/ApiNodeJSONEncoder';
|
|
||||||
|
|
||||||
export function Interface({ data }: { data: ApiInterfaceJSON }) {
|
export function Interface({ data }: { data: ApiInterfaceJSON }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
import type { ApiTypeAliasJSON } from '@discordjs/api-extractor-utils';
|
||||||
import { DocContainer } from '../DocContainer';
|
import { DocContainer } from '../DocContainer';
|
||||||
import type { ApiTypeAliasJSON } from '~/DocModel/ApiNodeJSONEncoder';
|
|
||||||
|
|
||||||
export function TypeAlias({ data }: { data: ApiTypeAliasJSON }) {
|
export function TypeAlias({ data }: { data: ApiTypeAliasJSON }) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
import type { ApiVariableJSON } from '@discordjs/api-extractor-utils';
|
||||||
import { DocContainer } from '../DocContainer';
|
import { DocContainer } from '../DocContainer';
|
||||||
import type { ApiVariableJSON } from '~/DocModel/ApiNodeJSONEncoder';
|
|
||||||
|
|
||||||
export function Variable({ data }: { data: ApiVariableJSON }) {
|
export function Variable({ data }: { data: ApiVariableJSON }) {
|
||||||
return <DocContainer name={data.name} kind={data.kind} excerpt={data.excerpt} summary={data.summary} />;
|
return <DocContainer name={data.name} kind={data.kind} excerpt={data.excerpt} summary={data.summary} />;
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
import type {
|
||||||
|
AnyDocNodeJSON,
|
||||||
|
DocPlainTextJSON,
|
||||||
|
DocNodeContainerJSON,
|
||||||
|
DocLinkTagJSON,
|
||||||
|
DocFencedCodeJSON,
|
||||||
|
DocBlockJSON,
|
||||||
|
DocCommentJSON,
|
||||||
|
} from '@discordjs/api-extractor-utils';
|
||||||
import { Anchor, Box, Code, Text, useMantineColorScheme } from '@mantine/core';
|
import { Anchor, Box, Code, Text, useMantineColorScheme } from '@mantine/core';
|
||||||
import { DocNodeKind, StandardTags } from '@microsoft/tsdoc';
|
import { DocNodeKind, StandardTags } from '@microsoft/tsdoc';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
@@ -5,13 +14,6 @@ import { Fragment, useCallback, type ReactNode } from 'react';
|
|||||||
import { PrismAsyncLight as SyntaxHighlighter } from 'react-syntax-highlighter';
|
import { PrismAsyncLight as SyntaxHighlighter } from 'react-syntax-highlighter';
|
||||||
import { vscDarkPlus, ghcolors } from 'react-syntax-highlighter/dist/cjs/styles/prism';
|
import { vscDarkPlus, ghcolors } from 'react-syntax-highlighter/dist/cjs/styles/prism';
|
||||||
import { BlockComment } from './BlockComment';
|
import { BlockComment } from './BlockComment';
|
||||||
import type { DocBlockJSON } from '~/DocModel/comment/CommentBlock';
|
|
||||||
import type { AnyDocNodeJSON } from '~/DocModel/comment/CommentNode';
|
|
||||||
import type { DocNodeContainerJSON } from '~/DocModel/comment/CommentNodeContainer';
|
|
||||||
import type { DocFencedCodeJSON } from '~/DocModel/comment/FencedCodeCommentNode';
|
|
||||||
import type { DocLinkTagJSON } from '~/DocModel/comment/LinkTagCommentNode';
|
|
||||||
import type { DocPlainTextJSON } from '~/DocModel/comment/PlainTextCommentNode';
|
|
||||||
import type { DocCommentJSON } from '~/DocModel/comment/RootComment';
|
|
||||||
|
|
||||||
export function TSDoc({ node }: { node: AnyDocNodeJSON }): JSX.Element {
|
export function TSDoc({ node }: { node: AnyDocNodeJSON }): JSX.Element {
|
||||||
const { colorScheme } = useMantineColorScheme();
|
const { colorScheme } = useMantineColorScheme();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
import type { ApiItemJSON } from '@discordjs/api-extractor-utils';
|
||||||
import { createContext, useContext, type ReactNode } from 'react';
|
import { createContext, useContext, type ReactNode } from 'react';
|
||||||
import type { ApiItemJSON } from '~/DocModel/ApiNodeJSONEncoder';
|
|
||||||
|
|
||||||
export const MemberContext = createContext<ApiItemJSON | undefined>(undefined);
|
export const MemberContext = createContext<ApiItemJSON | undefined>(undefined);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,17 @@
|
|||||||
import { readFile } from 'node:fs/promises';
|
import { readFile } from 'node:fs/promises';
|
||||||
import { join } from 'node:path';
|
import { join } from 'node:path';
|
||||||
import { cwd } from 'node:process';
|
import { cwd } from 'node:process';
|
||||||
|
import {
|
||||||
|
findPackage,
|
||||||
|
getMembers,
|
||||||
|
type ApiItemJSON,
|
||||||
|
type ApiClassJSON,
|
||||||
|
type ApiFunctionJSON,
|
||||||
|
type ApiInterfaceJSON,
|
||||||
|
type ApiTypeAliasJSON,
|
||||||
|
type ApiVariableJSON,
|
||||||
|
type ApiEnumJSON,
|
||||||
|
} from '@discordjs/api-extractor-utils';
|
||||||
import { ActionIcon, Affix, Box, LoadingOverlay, Transition } from '@mantine/core';
|
import { ActionIcon, Affix, Box, LoadingOverlay, Transition } from '@mantine/core';
|
||||||
import { useMediaQuery, useWindowScroll } from '@mantine/hooks';
|
import { useMediaQuery, useWindowScroll } from '@mantine/hooks';
|
||||||
import { ApiFunction, ApiItemKind, type ApiPackage } from '@microsoft/api-extractor-model';
|
import { ApiFunction, ApiItemKind, type ApiPackage } from '@microsoft/api-extractor-model';
|
||||||
@@ -15,15 +26,6 @@ import rehypePrettyCode from 'rehype-pretty-code';
|
|||||||
import rehypeRaw from 'rehype-raw';
|
import rehypeRaw from 'rehype-raw';
|
||||||
import rehypeSlug from 'rehype-slug';
|
import rehypeSlug from 'rehype-slug';
|
||||||
import remarkGfm from 'remark-gfm';
|
import remarkGfm from 'remark-gfm';
|
||||||
import type {
|
|
||||||
ApiClassJSON,
|
|
||||||
ApiEnumJSON,
|
|
||||||
ApiFunctionJSON,
|
|
||||||
ApiInterfaceJSON,
|
|
||||||
ApiItemJSON,
|
|
||||||
ApiTypeAliasJSON,
|
|
||||||
ApiVariableJSON,
|
|
||||||
} from '~/DocModel/ApiNodeJSONEncoder';
|
|
||||||
import { SidebarLayout, type SidebarLayoutProps } from '~/components/SidebarLayout';
|
import { SidebarLayout, type SidebarLayoutProps } from '~/components/SidebarLayout';
|
||||||
import { Class } from '~/components/model/Class';
|
import { Class } from '~/components/model/Class';
|
||||||
import { Enum } from '~/components/model/Enum';
|
import { Enum } from '~/components/model/Enum';
|
||||||
@@ -35,7 +37,6 @@ import { MemberProvider } from '~/contexts/member';
|
|||||||
import { createApiModel } from '~/util/api-model.server';
|
import { createApiModel } from '~/util/api-model.server';
|
||||||
import { findMember, findMemberByKey } from '~/util/model.server';
|
import { findMember, findMemberByKey } from '~/util/model.server';
|
||||||
import { PACKAGES } from '~/util/packages';
|
import { PACKAGES } from '~/util/packages';
|
||||||
import { findPackage, getMembers } from '~/util/parse.server';
|
|
||||||
|
|
||||||
export const getStaticPaths: GetStaticPaths = async () => {
|
export const getStaticPaths: GetStaticPaths = async () => {
|
||||||
const pkgs = (
|
const pkgs = (
|
||||||
@@ -94,11 +95,11 @@ export const getStaticPaths: GetStaticPaths = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const model = createApiModel(data);
|
const model = createApiModel(data);
|
||||||
const pkg = findPackage(model, packageName);
|
const pkg = findPackage(model, packageName)!;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{ params: { slug: ['packages', packageName, 'main'] } },
|
{ params: { slug: ['packages', packageName, 'main'] } },
|
||||||
...getMembers(pkg!, 'main').map((member) => {
|
...getMembers(pkg, 'main').map((member) => {
|
||||||
if (member.kind === ApiItemKind.Function && member.overloadIndex && member.overloadIndex > 1) {
|
if (member.kind === ApiItemKind.Function && member.overloadIndex && member.overloadIndex > 1) {
|
||||||
return {
|
return {
|
||||||
params: {
|
params: {
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export * from '@microsoft/api-extractor-model';
|
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
import { ApiItem, ApiModel, type ApiPackage } from '~/util/api-extractor.server';
|
|
||||||
import { TSDocConfigFile } from '~/util/tsdoc-config.server';
|
import { ApiModel, ApiItem, type ApiPackage } from '@microsoft/api-extractor-model';
|
||||||
import { TSDocConfiguration } from '~/util/tsdoc.server';
|
import { TSDocConfiguration } from '@microsoft/tsdoc';
|
||||||
|
import { TSDocConfigFile } from '@microsoft/tsdoc-config';
|
||||||
|
|
||||||
export function createApiModel(data: any) {
|
export function createApiModel(data: any) {
|
||||||
const model = new ApiModel();
|
const model = new ApiModel();
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
|
import { findPackage, ApiNodeJSONEncoder } from '@discordjs/api-extractor-utils';
|
||||||
import type { ApiEntryPoint, ApiModel } from '@microsoft/api-extractor-model';
|
import type { ApiEntryPoint, ApiModel } from '@microsoft/api-extractor-model';
|
||||||
import { findPackage } from './parse.server';
|
|
||||||
import { ApiNodeJSONEncoder } from '~/DocModel/ApiNodeJSONEncoder';
|
|
||||||
|
|
||||||
export function findMemberByKey(model: ApiModel, packageName: string, containerKey: string, version: string) {
|
export function findMemberByKey(model: ApiModel, packageName: string, containerKey: string, version: string) {
|
||||||
const pkg = findPackage(model, packageName)!;
|
const pkg = findPackage(model, packageName)!;
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export * from '@microsoft/tsdoc-config';
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export * from '@microsoft/tsdoc';
|
|
||||||
64
yarn.lock
64
yarn.lock
@@ -1755,6 +1755,29 @@ __metadata:
|
|||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
|
"@discordjs/api-extractor-utils@workspace:^, @discordjs/api-extractor-utils@workspace:packages/api-extractor-utils":
|
||||||
|
version: 0.0.0-use.local
|
||||||
|
resolution: "@discordjs/api-extractor-utils@workspace:packages/api-extractor-utils"
|
||||||
|
dependencies:
|
||||||
|
"@favware/cliff-jumper": ^1.8.7
|
||||||
|
"@microsoft/api-extractor-model": ^7.23.3
|
||||||
|
"@microsoft/tsdoc": ^0.14.1
|
||||||
|
"@types/node": ^16.11.54
|
||||||
|
"@typescript-eslint/eslint-plugin": ^5.34.0
|
||||||
|
"@typescript-eslint/parser": ^5.34.0
|
||||||
|
eslint: ^8.22.0
|
||||||
|
eslint-config-marine: ^9.4.1
|
||||||
|
eslint-config-prettier: ^8.5.0
|
||||||
|
eslint-import-resolver-typescript: ^3.5.0
|
||||||
|
eslint-plugin-import: ^2.26.0
|
||||||
|
eslint-plugin-tsdoc: ^0.2.16
|
||||||
|
prettier: ^2.7.1
|
||||||
|
rollup-plugin-typescript2: ^0.33.0
|
||||||
|
typescript: ^4.7.4
|
||||||
|
unbuild: ^0.8.9
|
||||||
|
languageName: unknown
|
||||||
|
linkType: soft
|
||||||
|
|
||||||
"@discordjs/builders@workspace:^, @discordjs/builders@workspace:packages/builders":
|
"@discordjs/builders@workspace:^, @discordjs/builders@workspace:packages/builders":
|
||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@discordjs/builders@workspace:packages/builders"
|
resolution: "@discordjs/builders@workspace:packages/builders"
|
||||||
@@ -1947,6 +1970,9 @@ __metadata:
|
|||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@discordjs/scripts@workspace:packages/scripts"
|
resolution: "@discordjs/scripts@workspace:packages/scripts"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
"@discordjs/api-extractor-utils": "workspace:^"
|
||||||
|
"@microsoft/api-extractor-model": ^7.23.3
|
||||||
|
"@microsoft/tsdoc": ^0.14.1
|
||||||
"@types/node": ^16.11.54
|
"@types/node": ^16.11.54
|
||||||
"@typescript-eslint/eslint-plugin": ^5.34.0
|
"@typescript-eslint/eslint-plugin": ^5.34.0
|
||||||
"@typescript-eslint/parser": ^5.34.0
|
"@typescript-eslint/parser": ^5.34.0
|
||||||
@@ -2007,6 +2033,7 @@ __metadata:
|
|||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@discordjs/website@workspace:packages/website"
|
resolution: "@discordjs/website@workspace:packages/website"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
"@discordjs/api-extractor-utils": "workspace:^"
|
||||||
"@emotion/react": ^11.10.0
|
"@emotion/react": ^11.10.0
|
||||||
"@emotion/server": ^11.10.0
|
"@emotion/server": ^11.10.0
|
||||||
"@mantine/core": ^5.2.3
|
"@mantine/core": ^5.2.3
|
||||||
@@ -2908,7 +2935,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@microsoft/api-extractor-model@npm:7.23.1, @microsoft/api-extractor-model@npm:^7.23.1":
|
"@microsoft/api-extractor-model@npm:7.23.1":
|
||||||
version: 7.23.1
|
version: 7.23.1
|
||||||
resolution: "@microsoft/api-extractor-model@npm:7.23.1"
|
resolution: "@microsoft/api-extractor-model@npm:7.23.1"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -2919,6 +2946,17 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"@microsoft/api-extractor-model@npm:^7.23.1, @microsoft/api-extractor-model@npm:^7.23.3":
|
||||||
|
version: 7.23.3
|
||||||
|
resolution: "@microsoft/api-extractor-model@npm:7.23.3"
|
||||||
|
dependencies:
|
||||||
|
"@microsoft/tsdoc": 0.14.1
|
||||||
|
"@microsoft/tsdoc-config": ~0.16.1
|
||||||
|
"@rushstack/node-core-library": 3.51.1
|
||||||
|
checksum: 00ec7a31d1f6d1583c3fcd97b16130bf8570e27cd3be2ecd07cf601b0c91ef63885a55bf068932c5d9278f8a9ab2046dc8305c0047158e6df5e86f5e56e35b77
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"@microsoft/api-extractor@npm:^7.29.3":
|
"@microsoft/api-extractor@npm:^7.29.3":
|
||||||
version: 7.29.3
|
version: 7.29.3
|
||||||
resolution: "@microsoft/api-extractor@npm:7.29.3"
|
resolution: "@microsoft/api-extractor@npm:7.29.3"
|
||||||
@@ -2965,7 +3003,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@microsoft/tsdoc@npm:0.14.1":
|
"@microsoft/tsdoc@npm:0.14.1, @microsoft/tsdoc@npm:^0.14.1":
|
||||||
version: 0.14.1
|
version: 0.14.1
|
||||||
resolution: "@microsoft/tsdoc@npm:0.14.1"
|
resolution: "@microsoft/tsdoc@npm:0.14.1"
|
||||||
checksum: e4ad038ccff2cd96e0d53ee42e2136f0f5a925b16cfda14261f1c2eb55ba0088a0e3b08ff819b476ddc69b2242a391925fab7f6ae2afabb19b96f87e19c114fc
|
checksum: e4ad038ccff2cd96e0d53ee42e2136f0f5a925b16cfda14261f1c2eb55ba0088a0e3b08ff819b476ddc69b2242a391925fab7f6ae2afabb19b96f87e19c114fc
|
||||||
@@ -3401,6 +3439,22 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"@rushstack/node-core-library@npm:3.51.1":
|
||||||
|
version: 3.51.1
|
||||||
|
resolution: "@rushstack/node-core-library@npm:3.51.1"
|
||||||
|
dependencies:
|
||||||
|
"@types/node": 12.20.24
|
||||||
|
colors: ~1.2.1
|
||||||
|
fs-extra: ~7.0.1
|
||||||
|
import-lazy: ~4.0.0
|
||||||
|
jju: ~1.4.0
|
||||||
|
resolve: ~1.17.0
|
||||||
|
semver: ~7.3.0
|
||||||
|
z-schema: ~5.0.2
|
||||||
|
checksum: 92f7e39f03f4931a7007b4a79427d82bfe078146133a138219205abf873607898f7667fa368e3cb28c93bb1a2b9dc70ddaf2d316bc47a9a17b591d69d1025068
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"@rushstack/rig-package@npm:0.3.14":
|
"@rushstack/rig-package@npm:0.3.14":
|
||||||
version: 0.3.14
|
version: 0.3.14
|
||||||
resolution: "@rushstack/rig-package@npm:0.3.14"
|
resolution: "@rushstack/rig-package@npm:0.3.14"
|
||||||
@@ -3959,9 +4013,9 @@ __metadata:
|
|||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@types/node@npm:^16.11.54":
|
"@types/node@npm:^16.11.54":
|
||||||
version: 16.11.54
|
version: 16.11.56
|
||||||
resolution: "@types/node@npm:16.11.54"
|
resolution: "@types/node@npm:16.11.56"
|
||||||
checksum: fa4d6a94498cc6ef96932a25557082587a178b5fa1da5e208bdb171b85265110a7ca6a4f296e740dca1b29d2a44b3c1e76e21d255e5eeed8be5f67ea538dcb9c
|
checksum: b4efade16eb08a39810921c54a1637e69c8f3184a20d87e8fe74d557d9bda73f0829ac318e2a30a32b1903e4b099812defd1dfe438be70b98dbfbea5b0d99a53
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user