mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 10:17:55 +02:00
feat: Docusaurus v3 upgrades and require TypeScript 5 (#9258)
This commit is contained in:
parent
da85e22778
commit
b3c8f5c929
26 changed files with 41 additions and 26 deletions
|
@ -72,7 +72,7 @@
|
|||
"@testing-library/react-hooks": "^8.0.1",
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
"@types/jest": "^29.5.3",
|
||||
"@types/lodash": "^4.14.195",
|
||||
"@types/lodash": "^4.14.197",
|
||||
"@types/node": "^18.16.19",
|
||||
"@types/prompts": "^2.4.4",
|
||||
"@types/react": "^18.2.15",
|
||||
|
@ -116,6 +116,6 @@
|
|||
"stylelint": "^14.16.1",
|
||||
"stylelint-config-prettier": "^9.0.5",
|
||||
"stylelint-config-standard": "^29.0.0",
|
||||
"typescript": "~5.0.4"
|
||||
"typescript": "~5.2.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.0.0-alpha.0",
|
||||
"@docusaurus/tsconfig": "3.0.0-alpha.0",
|
||||
"typescript": "~5.0.4"
|
||||
"typescript": "~5.2.2"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
"composite": true,
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": "./lib/.tsbuildinfo-client",
|
||||
"moduleResolution": "bundler",
|
||||
"module": "esnext",
|
||||
"target": "esnext",
|
||||
"rootDir": "src",
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
"composite": true,
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": "./lib/.tsbuildinfo-client",
|
||||
"moduleResolution": "bundler",
|
||||
"module": "esnext",
|
||||
"target": "esnext",
|
||||
"rootDir": "src",
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
"composite": true,
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": "./lib/.tsbuildinfo-client",
|
||||
"moduleResolution": "bundler",
|
||||
"module": "esnext",
|
||||
"target": "esnext",
|
||||
"rootDir": "src",
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
"composite": true,
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": "./lib/.tsbuildinfo-client",
|
||||
"moduleResolution": "bundler",
|
||||
"module": "esnext",
|
||||
"target": "esnext",
|
||||
"rootDir": "src",
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
"composite": true,
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": "./lib/.tsbuildinfo-client",
|
||||
"moduleResolution": "bundler",
|
||||
"module": "esnext",
|
||||
"target": "esnext",
|
||||
"rootDir": "src",
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
"composite": true,
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": "./lib/.tsbuildinfo-client",
|
||||
"moduleResolution": "bundler",
|
||||
"module": "esnext",
|
||||
"target": "esnext",
|
||||
"rootDir": "src",
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
"tsBuildInfoFile": "./lib/.tsbuildinfo-client",
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"moduleResolution": "bundler",
|
||||
"module": "esnext",
|
||||
"target": "esnext"
|
||||
},
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
"tsBuildInfoFile": "./lib/.tsbuildinfo-worker",
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"moduleResolution": "bundler",
|
||||
"module": "esnext",
|
||||
"target": "esnext",
|
||||
"types": ["node"]
|
||||
|
|
|
@ -891,7 +891,11 @@ declare module '@theme/MDXComponents' {
|
|||
import type Mermaid from '@theme/Mermaid';
|
||||
import type Head from '@docusaurus/Head';
|
||||
|
||||
export type MDXComponentsObject = {
|
||||
import type {MDXProvider} from '@mdx-js/react';
|
||||
|
||||
type MDXComponentsBase = ComponentProps<typeof MDXProvider>['components'];
|
||||
|
||||
export type MDXComponentsObject = MDXComponentsBase & {
|
||||
readonly Head: typeof Head;
|
||||
readonly details: typeof MDXDetails;
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import React, {useCallback, useState, useRef, useEffect} from 'react';
|
||||
import clsx from 'clsx';
|
||||
// @ts-expect-error: TODO, we need to make theme-classic have type: module
|
||||
import copy from 'copy-text-to-clipboard';
|
||||
import {translate} from '@docusaurus/Translate';
|
||||
import type {Props} from '@theme/CodeBlock/CopyButton';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React, {type ComponentProps} from 'react';
|
||||
import Head from '@docusaurus/Head';
|
||||
import MDXCode from '@theme/MDXComponents/Code';
|
||||
import MDXA from '@theme/MDXComponents/A';
|
||||
|
@ -28,12 +28,12 @@ const MDXComponents: MDXComponentsObject = {
|
|||
pre: MDXPre,
|
||||
ul: MDXUl,
|
||||
img: MDXImg,
|
||||
h1: (props) => <MDXHeading as="h1" {...props} />,
|
||||
h2: (props) => <MDXHeading as="h2" {...props} />,
|
||||
h3: (props) => <MDXHeading as="h3" {...props} />,
|
||||
h4: (props) => <MDXHeading as="h4" {...props} />,
|
||||
h5: (props) => <MDXHeading as="h5" {...props} />,
|
||||
h6: (props) => <MDXHeading as="h6" {...props} />,
|
||||
h1: (props: ComponentProps<'h1'>) => <MDXHeading as="h1" {...props} />,
|
||||
h2: (props: ComponentProps<'h2'>) => <MDXHeading as="h2" {...props} />,
|
||||
h3: (props: ComponentProps<'h3'>) => <MDXHeading as="h3" {...props} />,
|
||||
h4: (props: ComponentProps<'h4'>) => <MDXHeading as="h4" {...props} />,
|
||||
h5: (props: ComponentProps<'h5'>) => <MDXHeading as="h5" {...props} />,
|
||||
h6: (props: ComponentProps<'h6'>) => <MDXHeading as="h6" {...props} />,
|
||||
admonition: Admonition,
|
||||
mermaid: Mermaid,
|
||||
};
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
// @ts-expect-error: TODO see https://github.com/microsoft/TypeScript/issues/49721
|
||||
import {MDXProvider} from '@mdx-js/react';
|
||||
import MDXComponents from '@theme/MDXComponents';
|
||||
import type {Props} from '@theme/MDXContent';
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
"tsBuildInfoFile": "./lib/.tsbuildinfo-client",
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"moduleResolution": "bundler",
|
||||
"module": "esnext",
|
||||
"target": "esnext"
|
||||
},
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"noEmit": false,
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": "./lib/.tsbuildinfo",
|
||||
"moduleResolution": "bundler",
|
||||
"module": "esnext",
|
||||
"target": "esnext",
|
||||
"sourceMap": true,
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
"tsBuildInfoFile": "./lib/.tsbuildinfo-client",
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"moduleResolution": "bundler",
|
||||
"module": "esnext",
|
||||
"target": "esnext"
|
||||
},
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
"tsBuildInfoFile": "./lib/.tsbuildinfo-client",
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"moduleResolution": "bundler",
|
||||
"module": "esnext",
|
||||
"target": "esnext"
|
||||
},
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
"noEmit": false,
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": "./lib/.tsbuildinfo",
|
||||
"module": "commonjs",
|
||||
"rootDir": "src",
|
||||
"outDir": "lib"
|
||||
},
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
"tsBuildInfoFile": "./lib/.tsbuildinfo-client",
|
||||
"rootDir": "src",
|
||||
"outDir": "lib",
|
||||
"moduleResolution": "bundler",
|
||||
"module": "esnext",
|
||||
"target": "esnext"
|
||||
},
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
"esModuleInterop": true,
|
||||
"jsx": "preserve",
|
||||
"lib": ["DOM"],
|
||||
"moduleResolution": "Node16",
|
||||
"moduleResolution": "bundler",
|
||||
"module": "esnext",
|
||||
"noEmit": true,
|
||||
"types": [
|
||||
"node",
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
"composite": true,
|
||||
"incremental": true,
|
||||
"tsBuildInfoFile": "./lib/.tsbuildinfo-client",
|
||||
"moduleResolution": "bundler",
|
||||
"module": "esnext",
|
||||
"target": "esnext",
|
||||
"rootDir": "src",
|
||||
|
|
|
@ -11,7 +11,6 @@ import Layout from '@theme/Layout';
|
|||
import Heading from '@theme/Heading';
|
||||
|
||||
const HeavyComponentLazy = React.lazy(
|
||||
// @ts-expect-error: not sure why TS is unhappy about this...
|
||||
() => import('./_components/heavyComponent'),
|
||||
);
|
||||
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
|
||||
const path = require('path');
|
||||
const npm2yarn = require('@docusaurus/remark-plugin-npm2yarn');
|
||||
/** @type {Array<string>} */
|
||||
const versions = require('./versions.json');
|
||||
/** @type {Record<string,string>} */
|
||||
const VersionsArchived = require('./versionsArchived.json');
|
||||
const {
|
||||
dogfoodingPluginInstances,
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
"noUnusedParameters": false,
|
||||
"importsNotUsedAsValues": "remove",
|
||||
|
||||
"moduleResolution": "NodeNext",
|
||||
|
||||
// This is important. We run `yarn tsc` in website so we can catch issues
|
||||
// with our declaration files (mostly names that are forgotten to be
|
||||
// imported, invalid semantics...). Because we don't have end-to-end type
|
||||
|
|
16
yarn.lock
16
yarn.lock
|
@ -3396,10 +3396,10 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/katex/-/katex-0.16.1.tgz#e1faa29f131c241a7669e65bdf8ce470c9c4e3a9"
|
||||
integrity sha512-cwglq2A63Yk082CQk0t8LIoDhZAVgJqkumLyk3grpg3K8sevaDW//Qsspmxj9Sf+97biqt79CfAlPrvizHlP0w==
|
||||
|
||||
"@types/lodash@^4.14.195":
|
||||
version "4.14.195"
|
||||
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.195.tgz#bafc975b252eb6cea78882ce8a7b6bf22a6de632"
|
||||
integrity sha512-Hwx9EUgdwf2GLarOjQp5ZH8ZmblzcbTBC2wtQWNKARBSxM9ezRIAUpeDTgoQRAFB0+8CNWXVA9+MaSOzOF3nPg==
|
||||
"@types/lodash@^4.14.197":
|
||||
version "4.14.197"
|
||||
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.197.tgz#e95c5ddcc814ec3e84c891910a01e0c8a378c54b"
|
||||
integrity sha512-BMVOiWs0uNxHVlHBgzTIqJYmj+PgCo4euloGF+5m4okL3rEYzM2EEv78mw8zWSMM57dM7kVIgJ2QDvwHSoCI5g==
|
||||
|
||||
"@types/mdast@^3.0.0", "@types/mdast@^3.0.12":
|
||||
version "3.0.12"
|
||||
|
@ -16320,10 +16320,10 @@ typedarray@^0.0.6:
|
|||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
|
||||
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==
|
||||
|
||||
typescript@~5.0.4:
|
||||
version "5.0.4"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b"
|
||||
integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==
|
||||
typescript@~5.2.2:
|
||||
version "5.2.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78"
|
||||
integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==
|
||||
|
||||
ua-parser-js@^1.0.35:
|
||||
version "1.0.35"
|
||||
|
|
Loading…
Add table
Reference in a new issue