chore: upgrade syntax highlighting dependencies, prism-react-renderer to v2, react-live to v4 (#9316)

Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
Chongyi Zheng 2023-10-06 13:15:14 -04:00 committed by GitHub
parent df42d891c2
commit dceaae41d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 124 additions and 137 deletions

View file

@ -30,7 +30,7 @@
"@philpl/buble": "^0.19.7",
"clsx": "^1.2.1",
"fs-extra": "^11.1.1",
"react-live": "2.2.3",
"react-live": "^4.1.5",
"tslib": "^2.6.0"
},
"devDependencies": {

View file

@ -7,7 +7,8 @@
declare module '@philpl/buble' {
import type {TransformOptions as OriginalTransformOptions} from 'buble';
// eslint-disable-next-line import/no-extraneous-dependencies, no-restricted-syntax
// eslint-disable-next-line no-restricted-syntax
export * from 'buble';
export const features: string[];
export type TransformOptions = OriginalTransformOptions & {

View file

@ -18,9 +18,10 @@ declare module '@docusaurus/theme-live-codeblock' {
declare module '@theme/Playground' {
import type {Props as BaseProps} from '@theme/CodeBlock';
import type {LiveProviderProps} from 'react-live';
import type {LiveProvider} from 'react-live';
type CodeBlockProps = Omit<BaseProps, 'className' | 'language' | 'title'>;
type LiveProviderProps = React.ComponentProps<typeof LiveProvider>;
export interface Props extends CodeBlockProps, LiveProviderProps {
children: string;

View file

@ -13,7 +13,6 @@ import CodeBlock, {type Props} from '@theme-init/CodeBlock';
const withLiveEditor = (Component: typeof CodeBlock) => {
function WrappedComponent(props: Props) {
if (props.live) {
// @ts-expect-error: we have deliberately widened the type of language prop
return <Playground scope={ReactLiveScope} {...props} />;
}

View file

@ -115,7 +115,6 @@ export default function Playground({
return (
<div className={styles.playgroundContainer}>
{/* @ts-expect-error: type incompatibility with refs */}
<LiveProvider
code={children.replace(/\n$/, '')}
noInline={noInline}