mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
chore: remaining deps and lighthouse removal
This commit is contained in:
@@ -67,12 +67,12 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@next/bundle-analyzer": "14.0.2-canary.20",
|
||||
"@testing-library/react": "^14.0.0",
|
||||
"@testing-library/react": "^14.1.0",
|
||||
"@testing-library/user-event": "^14.5.1",
|
||||
"@types/html-escaper": "^3.0.1",
|
||||
"@types/html-escaper": "^3.0.2",
|
||||
"@types/node": "18.18.8",
|
||||
"@types/react": "^18.2.36",
|
||||
"@types/react-dom": "^18.2.14",
|
||||
"@types/react": "^18.2.37",
|
||||
"@types/react-dom": "^18.2.15",
|
||||
"@unocss/eslint-plugin": "^0.57.2",
|
||||
"@unocss/postcss": "^0.57.2",
|
||||
"@unocss/reset": "^0.57.2",
|
||||
@@ -92,7 +92,7 @@
|
||||
"turbo": "^1.10.16",
|
||||
"typescript": "^5.2.2",
|
||||
"unocss": "^0.57.2",
|
||||
"vercel": "^32.5.0",
|
||||
"vercel": "^32.5.2",
|
||||
"vitest": "^0.34.6"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -5,23 +5,19 @@
|
||||
"jsx": "preserve",
|
||||
"baseUrl": ".",
|
||||
"noEmit": true,
|
||||
"skipLibCheck": true,
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"~/*": ["./src/*"],
|
||||
"contentlayer/generated": ["./.contentlayer/generated"]
|
||||
},
|
||||
"moduleResolution": "node",
|
||||
"resolvePackageJsonExports": false,
|
||||
"resolvePackageJsonImports": false,
|
||||
"esModuleInterop": true,
|
||||
"allowJs": true,
|
||||
"incremental": true
|
||||
"incremental": true,
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx", "next-env.d.ts", ".next/types/**/*.ts", ".contentlayer/generated"],
|
||||
"include": ["**/*.ts", "**/*.tsx", "next-env.d.ts", ".next/types/**/*.ts", ".contentlayer/generated"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
||||
@@ -76,11 +76,11 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@next/bundle-analyzer": "14.0.2-canary.20",
|
||||
"@testing-library/react": "^14.0.0",
|
||||
"@testing-library/react": "^14.1.0",
|
||||
"@testing-library/user-event": "^14.5.1",
|
||||
"@types/node": "18.18.8",
|
||||
"@types/react": "^18.2.36",
|
||||
"@types/react-dom": "^18.2.14",
|
||||
"@types/react": "^18.2.37",
|
||||
"@types/react-dom": "^18.2.15",
|
||||
"@unocss/eslint-plugin": "^0.57.2",
|
||||
"@unocss/postcss": "^0.57.2",
|
||||
"@unocss/reset": "^0.57.2",
|
||||
@@ -97,7 +97,7 @@
|
||||
"prettier": "^3.0.3",
|
||||
"turbo": "^1.10.16",
|
||||
"typescript": "^5.2.2",
|
||||
"vercel": "^32.5.0",
|
||||
"vercel": "^32.5.2",
|
||||
"vitest": "^0.34.6"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { ApiFunction, ApiItem } from '@discordjs/api-extractor-model';
|
||||
import { ApiModel } from '@discordjs/api-extractor-model';
|
||||
import dynamic from 'next/dynamic';
|
||||
import {} from 'next/types';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { cache, type PropsWithChildren } from 'react';
|
||||
import { fetchModelJSON, fetchVersions } from '~/app/docAPI';
|
||||
@@ -15,12 +16,12 @@ import { Providers } from './providers';
|
||||
const Header = dynamic(async () => import('~/components/Header'));
|
||||
const Footer = dynamic(async () => import('~/components/Footer'));
|
||||
|
||||
export interface VersionRouteParams {
|
||||
interface VersionRouteParams {
|
||||
package: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
export async function generateStaticParams() {
|
||||
export const generateStaticParams = async () => {
|
||||
const params: VersionRouteParams[] = [];
|
||||
|
||||
await Promise.all(
|
||||
@@ -32,7 +33,7 @@ export async function generateStaticParams() {
|
||||
);
|
||||
|
||||
return params;
|
||||
}
|
||||
};
|
||||
|
||||
const serializeIntoSidebarItemData = cache((item: ApiItem) => {
|
||||
return {
|
||||
|
||||
@@ -1,33 +1,38 @@
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { join } from 'node:path';
|
||||
import type { SerializeOptions } from 'next-mdx-remote/dist/types';
|
||||
import { MDXRemote } from 'next-mdx-remote/rsc';
|
||||
import { compileMDX } from 'next-mdx-remote/rsc';
|
||||
import { cache } from 'react';
|
||||
import rehypeSlug from 'rehype-slug';
|
||||
import remarkGfm from 'remark-gfm';
|
||||
import { SyntaxHighlighter } from '~/components/SyntaxHighlighter';
|
||||
import type { VersionRouteParams } from './layout';
|
||||
|
||||
interface VersionRouteParams {
|
||||
package: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
const loadREADME = cache(async (packageName: string) => {
|
||||
return readFile(join(process.cwd(), 'src', 'assets', 'readme', packageName, 'home-README.md'), 'utf8');
|
||||
});
|
||||
|
||||
const mdxOptions = {
|
||||
mdxOptions: {
|
||||
remarkPlugins: [remarkGfm],
|
||||
rehypePlugins: [rehypeSlug],
|
||||
format: 'mdx',
|
||||
},
|
||||
} satisfies SerializeOptions;
|
||||
export async function generateStaticParams({ params }: { params: VersionRouteParams }) {
|
||||
return [{ package: params.package, version: params.version }];
|
||||
}
|
||||
|
||||
export default async function Page({ params }: { params: VersionRouteParams }) {
|
||||
const { package: packageName } = params;
|
||||
const readmeSource = await loadREADME(packageName);
|
||||
const readmeSource = await loadREADME(params.package);
|
||||
const { content } = await compileMDX({
|
||||
source: readmeSource,
|
||||
// @ts-expect-error SyntaxHighlighter is assignable
|
||||
components: { pre: SyntaxHighlighter },
|
||||
options: {
|
||||
mdxOptions: {
|
||||
remarkPlugins: [remarkGfm],
|
||||
rehypePlugins: [rehypeSlug],
|
||||
format: 'mdx',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="relative top-4 max-w-none prose">
|
||||
{/* @ts-expect-error SyntaxHighlighter is assignable */}
|
||||
<MDXRemote components={{ pre: SyntaxHighlighter }} options={mdxOptions} source={readmeSource} />
|
||||
</div>
|
||||
);
|
||||
return <div className="relative top-4 max-w-none prose">{content}</div>;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Code } from 'bright';
|
||||
|
||||
export function SyntaxHighlighter(props: typeof Code) {
|
||||
export async function SyntaxHighlighter(props: typeof Code) {
|
||||
return (
|
||||
<>
|
||||
<div data-theme="dark">
|
||||
|
||||
@@ -5,22 +5,18 @@
|
||||
"jsx": "preserve",
|
||||
"baseUrl": ".",
|
||||
"noEmit": true,
|
||||
"skipLibCheck": true,
|
||||
"paths": {
|
||||
"~/*": ["./src/*"]
|
||||
},
|
||||
"esModuleInterop": true,
|
||||
"allowJs": true,
|
||||
"incremental": true,
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"~/*": ["./src/*"]
|
||||
},
|
||||
"moduleResolution": "node",
|
||||
"resolvePackageJsonExports": false,
|
||||
"resolvePackageJsonImports": false,
|
||||
"esModuleInterop": true,
|
||||
"allowJs": true,
|
||||
"incremental": true
|
||||
]
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx", "next-env.d.ts", ".next/types/**/*.ts"],
|
||||
"include": ["**/*.ts", "**/*.tsx", "next-env.d.ts", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user