@docusaurus/plugin-debug 2.0.0-beta.1decd6f80 → 2.0.0-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +2 -2
- package/lib/index.js +13 -10
- package/lib/theme/DebugConfig/index.d.ts +8 -0
- package/lib/theme/DebugConfig/index.js +20 -0
- package/lib/theme/DebugContent/index.d.ts +9 -0
- package/lib/theme/DebugContent/index.js +34 -0
- package/lib/theme/DebugGlobalData/index.d.ts +8 -0
- package/lib/theme/DebugGlobalData/index.js +20 -0
- package/lib/theme/DebugJsonView/index.d.ts +9 -0
- package/lib/theme/DebugJsonView/index.js +35 -0
- package/lib/theme/DebugLayout/index.d.ts +10 -0
- package/lib/theme/DebugLayout/index.js +35 -0
- package/lib/theme/DebugLayout/styles.module.css +75 -0
- package/lib/theme/DebugRegistry/index.d.ts +8 -0
- package/lib/theme/DebugRegistry/index.js +25 -0
- package/lib/theme/DebugRegistry/styles.module.css +13 -0
- package/lib/theme/DebugRoutes/index.d.ts +8 -0
- package/lib/theme/DebugRoutes/index.js +28 -0
- package/lib/theme/DebugRoutes/styles.module.css +21 -0
- package/lib/theme/DebugSiteMetadata/index.d.ts +8 -0
- package/lib/theme/DebugSiteMetadata/index.js +35 -0
- package/lib/theme/DebugSiteMetadata/styles.module.css +26 -0
- package/package.json +13 -9
- package/src/index.ts +6 -3
- package/src/plugin-debug.d.ts +59 -0
- package/src/theme/DebugConfig/{index.js → index.tsx} +4 -6
- package/src/theme/DebugContent/index.tsx +77 -0
- package/src/theme/DebugGlobalData/{index.js → index.tsx} +4 -6
- package/src/theme/DebugJsonView/{index.js → index.tsx} +16 -14
- package/src/theme/DebugLayout/{index.js → index.tsx} +21 -16
- package/src/theme/DebugLayout/styles.module.css +1 -1
- package/src/theme/DebugRegistry/{index.js → index.tsx} +3 -5
- package/src/theme/DebugRegistry/styles.module.css +0 -5
- package/src/theme/DebugRoutes/{index.js → index.tsx} +4 -6
- package/src/theme/DebugRoutes/styles.module.css +0 -5
- package/src/theme/DebugSiteMetadata/{index.js → index.tsx} +9 -10
- package/src/theme/DebugSiteMetadata/styles.module.css +0 -5
- package/lib/.tsbuildinfo +0 -3895
- package/src/theme/DebugContent/index.js +0 -70
- package/tsconfig.json +0 -9
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/// <reference types="@docusaurus/module-type-aliases" />
|
|
9
|
+
|
|
10
|
+
declare module '@docusaurus/plugin-debug' {
|
|
11
|
+
import type {LoadContext, Plugin} from '@docusaurus/types';
|
|
12
|
+
|
|
13
|
+
export default function pluginDebug(context: LoadContext): Plugin<undefined>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare module '@theme/DebugConfig' {
|
|
17
|
+
export default function DebugMetadata(): JSX.Element;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare module '@theme/DebugContent' {
|
|
21
|
+
import type {AllContent} from '@docusaurus/types';
|
|
22
|
+
|
|
23
|
+
export interface Props {
|
|
24
|
+
readonly allContent: AllContent;
|
|
25
|
+
}
|
|
26
|
+
export default function DebugContent(props: Props): JSX.Element;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare module '@theme/DebugGlobalData' {
|
|
30
|
+
export default function DebugGlobalData(): JSX.Element;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare module '@theme/DebugJsonView' {
|
|
34
|
+
export interface Props {
|
|
35
|
+
readonly src: unknown;
|
|
36
|
+
readonly collapseDepth?: number;
|
|
37
|
+
}
|
|
38
|
+
export default function DebugJsonView(props: Props): JSX.Element;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare module '@theme/DebugLayout' {
|
|
42
|
+
import type {ReactNode} from 'react';
|
|
43
|
+
|
|
44
|
+
export default function DebugLayout(props: {
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
}): JSX.Element;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare module '@theme/DebugRegistry' {
|
|
50
|
+
export default function DebugRegistry(): JSX.Element;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare module '@theme/DebugRoutes' {
|
|
54
|
+
export default function DebugRoutes(): JSX.Element;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
declare module '@theme/DebugSiteMetadata' {
|
|
58
|
+
export default function DebugSiteMetadata(): JSX.Element;
|
|
59
|
+
}
|
|
@@ -7,19 +7,17 @@
|
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
|
-
import DebugLayout from '
|
|
11
|
-
import DebugJsonView from '
|
|
10
|
+
import DebugLayout from '@theme/DebugLayout';
|
|
11
|
+
import DebugJsonView from '@theme/DebugJsonView';
|
|
12
12
|
|
|
13
13
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
14
14
|
|
|
15
|
-
function DebugMetadata() {
|
|
15
|
+
export default function DebugMetadata(): JSX.Element {
|
|
16
16
|
const {siteConfig} = useDocusaurusContext();
|
|
17
17
|
return (
|
|
18
18
|
<DebugLayout>
|
|
19
19
|
<h2>Site config</h2>
|
|
20
|
-
<DebugJsonView src={siteConfig} collapseDepth=
|
|
20
|
+
<DebugJsonView src={siteConfig} collapseDepth={3} />
|
|
21
21
|
</DebugLayout>
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
export default DebugMetadata;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
import DebugLayout from '@theme/DebugLayout';
|
|
11
|
+
import DebugJsonView from '@theme/DebugJsonView';
|
|
12
|
+
import type {Props} from '@theme/DebugContent';
|
|
13
|
+
|
|
14
|
+
function PluginInstanceContent({
|
|
15
|
+
pluginId,
|
|
16
|
+
pluginInstanceContent,
|
|
17
|
+
}: {
|
|
18
|
+
pluginId: string;
|
|
19
|
+
pluginInstanceContent: unknown;
|
|
20
|
+
}) {
|
|
21
|
+
return (
|
|
22
|
+
<section style={{marginBottom: 30}}>
|
|
23
|
+
<code>{pluginId}</code>
|
|
24
|
+
<DebugJsonView src={pluginInstanceContent} collapseDepth={2} />
|
|
25
|
+
</section>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function PluginContent({
|
|
30
|
+
pluginName,
|
|
31
|
+
pluginContent,
|
|
32
|
+
}: {
|
|
33
|
+
pluginName: string;
|
|
34
|
+
pluginContent: {[pluginId: string]: unknown};
|
|
35
|
+
}) {
|
|
36
|
+
return (
|
|
37
|
+
<section style={{marginBottom: 60}}>
|
|
38
|
+
<h3>{pluginName}</h3>
|
|
39
|
+
<div>
|
|
40
|
+
{Object.entries(pluginContent)
|
|
41
|
+
// Filter plugin instances with no content
|
|
42
|
+
.filter(([, pluginInstanceContent]) => !!pluginInstanceContent)
|
|
43
|
+
.map(([pluginId, pluginInstanceContent]) => (
|
|
44
|
+
<PluginInstanceContent
|
|
45
|
+
key={pluginId}
|
|
46
|
+
pluginId={pluginId}
|
|
47
|
+
pluginInstanceContent={pluginInstanceContent}
|
|
48
|
+
/>
|
|
49
|
+
))}
|
|
50
|
+
</div>
|
|
51
|
+
</section>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default function DebugContent({allContent}: Props): JSX.Element {
|
|
56
|
+
return (
|
|
57
|
+
<DebugLayout>
|
|
58
|
+
<h2>Plugin content</h2>
|
|
59
|
+
<div>
|
|
60
|
+
{Object.entries(allContent)
|
|
61
|
+
// Filter plugins with no content
|
|
62
|
+
.filter(([, pluginContent]) =>
|
|
63
|
+
Object.values(pluginContent).some(
|
|
64
|
+
(instanceContent) => !!instanceContent,
|
|
65
|
+
),
|
|
66
|
+
)
|
|
67
|
+
.map(([pluginName, pluginContent]) => (
|
|
68
|
+
<PluginContent
|
|
69
|
+
key={pluginName}
|
|
70
|
+
pluginName={pluginName}
|
|
71
|
+
pluginContent={pluginContent}
|
|
72
|
+
/>
|
|
73
|
+
))}
|
|
74
|
+
</div>
|
|
75
|
+
</DebugLayout>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
@@ -7,18 +7,16 @@
|
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
|
-
import DebugLayout from '
|
|
11
|
-
import DebugJsonView from '
|
|
10
|
+
import DebugLayout from '@theme/DebugLayout';
|
|
11
|
+
import DebugJsonView from '@theme/DebugJsonView';
|
|
12
12
|
import useGlobalData from '@docusaurus/useGlobalData';
|
|
13
13
|
|
|
14
|
-
function DebugMetadata() {
|
|
14
|
+
export default function DebugMetadata(): JSX.Element {
|
|
15
15
|
const globalData = useGlobalData();
|
|
16
16
|
return (
|
|
17
17
|
<DebugLayout>
|
|
18
18
|
<h2>Global data</h2>
|
|
19
|
-
<DebugJsonView src={globalData} collapseDepth=
|
|
19
|
+
<DebugJsonView src={globalData} collapseDepth={3} />
|
|
20
20
|
</DebugLayout>
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
export default DebugMetadata;
|
|
@@ -6,30 +6,34 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
-
|
|
10
9
|
import BrowserOnly from '@docusaurus/BrowserOnly';
|
|
10
|
+
import type {Props} from '@theme/DebugJsonView';
|
|
11
|
+
import type {ReactJsonViewProps} from 'react-json-view';
|
|
11
12
|
|
|
12
|
-
//
|
|
13
|
-
const RootName =
|
|
13
|
+
// Avoids "react-json-view" displaying "root"
|
|
14
|
+
const RootName = null;
|
|
14
15
|
|
|
15
16
|
// Seems ReactJson does not work with SSR
|
|
16
17
|
// https://github.com/mac-s-g/react-json-view/issues/121
|
|
17
|
-
|
|
18
|
+
function BrowserOnlyReactJson(props: ReactJsonViewProps) {
|
|
18
19
|
return (
|
|
19
20
|
<BrowserOnly>
|
|
20
21
|
{() => {
|
|
21
|
-
// eslint-disable-next-line global-require
|
|
22
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
22
23
|
const ReactJson = require('react-json-view').default;
|
|
23
24
|
return <ReactJson {...props} />;
|
|
24
25
|
}}
|
|
25
26
|
</BrowserOnly>
|
|
26
27
|
);
|
|
27
|
-
}
|
|
28
|
+
}
|
|
28
29
|
|
|
29
|
-
function DebugJsonView({
|
|
30
|
+
export default function DebugJsonView({
|
|
31
|
+
src,
|
|
32
|
+
collapseDepth,
|
|
33
|
+
}: Props): JSX.Element {
|
|
30
34
|
return (
|
|
31
35
|
<BrowserOnlyReactJson
|
|
32
|
-
src={src}
|
|
36
|
+
src={src as object}
|
|
33
37
|
style={{
|
|
34
38
|
marginTop: '10px',
|
|
35
39
|
padding: '10px',
|
|
@@ -38,18 +42,16 @@ function DebugJsonView({src, collapseDepth}) {
|
|
|
38
42
|
}}
|
|
39
43
|
name={RootName}
|
|
40
44
|
theme="paraiso"
|
|
41
|
-
shouldCollapse={(field) =>
|
|
45
|
+
shouldCollapse={(field) =>
|
|
42
46
|
// By default, we collapse the json for performance reasons
|
|
43
47
|
// See https://github.com/mac-s-g/react-json-view/issues/235
|
|
44
48
|
// Non-root elements that are larger than 50 fields are collapsed
|
|
45
|
-
|
|
46
|
-
}
|
|
49
|
+
field.name !== RootName && Object.keys(field.src).length > 50
|
|
50
|
+
}
|
|
47
51
|
collapsed={collapseDepth}
|
|
48
|
-
groupArraysAfterLength=
|
|
52
|
+
groupArraysAfterLength={5}
|
|
49
53
|
enableClipboard={false}
|
|
50
54
|
displayDataTypes={false}
|
|
51
55
|
/>
|
|
52
56
|
);
|
|
53
57
|
}
|
|
54
|
-
|
|
55
|
-
export default DebugJsonView;
|
|
@@ -5,30 +5,37 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import React from 'react';
|
|
8
|
+
import React, {type ReactNode} from 'react';
|
|
9
9
|
import Head from '@docusaurus/Head';
|
|
10
10
|
import Link from '@docusaurus/Link';
|
|
11
11
|
import styles from './styles.module.css';
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
function DebugNavLink({to, children}: {to: string; children: ReactNode}) {
|
|
14
|
+
return (
|
|
15
|
+
<Link
|
|
16
|
+
className={styles.navlink}
|
|
17
|
+
isNavLink
|
|
18
|
+
to={to}
|
|
19
|
+
exact
|
|
20
|
+
activeStyle={{
|
|
21
|
+
backgroundColor: '#363739',
|
|
22
|
+
}}>
|
|
23
|
+
{children}
|
|
24
|
+
</Link>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
25
27
|
|
|
26
|
-
function DebugLayout({
|
|
28
|
+
export default function DebugLayout({
|
|
29
|
+
children,
|
|
30
|
+
}: {
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
}): JSX.Element {
|
|
27
33
|
return (
|
|
28
34
|
<>
|
|
29
35
|
<Head>
|
|
30
36
|
<html lang="en" />
|
|
31
37
|
<title>Docusaurus debug panel</title>
|
|
38
|
+
<meta name="robots" content="noindex" />
|
|
32
39
|
</Head>
|
|
33
40
|
|
|
34
41
|
<div>
|
|
@@ -51,5 +58,3 @@ function DebugLayout({children}) {
|
|
|
51
58
|
</>
|
|
52
59
|
);
|
|
53
60
|
}
|
|
54
|
-
|
|
55
|
-
export default DebugLayout;
|
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
|
-
import DebugLayout from '
|
|
10
|
+
import DebugLayout from '@theme/DebugLayout';
|
|
11
11
|
import registry from '@generated/registry';
|
|
12
12
|
import styles from './styles.module.css';
|
|
13
13
|
|
|
14
|
-
function DebugRegistry() {
|
|
14
|
+
export default function DebugRegistry(): JSX.Element {
|
|
15
15
|
return (
|
|
16
16
|
<DebugLayout>
|
|
17
17
|
<h2>Registry</h2>
|
|
18
|
-
<ul className=
|
|
18
|
+
<ul className="clean-list">
|
|
19
19
|
{Object.values(registry).map(([, aliasedPath, resolved]) => (
|
|
20
20
|
<li key={aliasedPath} className={styles.listItem}>
|
|
21
21
|
<div style={{marginBottom: '10px'}}>
|
|
@@ -30,5 +30,3 @@ function DebugRegistry() {
|
|
|
30
30
|
</DebugLayout>
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
export default DebugRegistry;
|
|
@@ -7,16 +7,16 @@
|
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
|
-
import DebugLayout from '
|
|
11
|
-
import DebugJsonView from '
|
|
10
|
+
import DebugLayout from '@theme/DebugLayout';
|
|
11
|
+
import DebugJsonView from '@theme/DebugJsonView';
|
|
12
12
|
import routes from '@generated/routes';
|
|
13
13
|
import styles from './styles.module.css';
|
|
14
14
|
|
|
15
|
-
function DebugRoutes() {
|
|
15
|
+
export default function DebugRoutes(): JSX.Element {
|
|
16
16
|
return (
|
|
17
17
|
<DebugLayout>
|
|
18
18
|
<h2>Routes</h2>
|
|
19
|
-
<ul className=
|
|
19
|
+
<ul className="clean-list">
|
|
20
20
|
{routes.map(({path, exact, routes: childRoutes}) => (
|
|
21
21
|
<li key={path} className={styles.listItem}>
|
|
22
22
|
<div className={styles.route}>
|
|
@@ -37,5 +37,3 @@ function DebugRoutes() {
|
|
|
37
37
|
</DebugLayout>
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
export default DebugRoutes;
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
|
-
import DebugLayout from '
|
|
10
|
+
import DebugLayout from '@theme/DebugLayout';
|
|
11
11
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
12
12
|
import styles from './styles.module.css';
|
|
13
13
|
|
|
14
|
-
function DebugMetadata() {
|
|
14
|
+
export default function DebugMetadata(): JSX.Element {
|
|
15
15
|
const {siteMetadata} = useDocusaurusContext();
|
|
16
16
|
return (
|
|
17
17
|
<DebugLayout>
|
|
@@ -24,15 +24,16 @@ function DebugMetadata() {
|
|
|
24
24
|
<code>{siteMetadata.siteVersion || 'No version specified'}</code>
|
|
25
25
|
</div>
|
|
26
26
|
<h3 className={styles.sectionTitle}>Plugins and themes</h3>
|
|
27
|
-
<ul className=
|
|
27
|
+
<ul className="clean-list">
|
|
28
28
|
{Object.entries(siteMetadata.pluginVersions).map(
|
|
29
29
|
([name, versionInformation]) => (
|
|
30
30
|
<li key={name} className={styles.listItem}>
|
|
31
|
-
{versionInformation.
|
|
32
|
-
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
{versionInformation.type === 'package' &&
|
|
32
|
+
versionInformation.version && (
|
|
33
|
+
<div className={styles.version}>
|
|
34
|
+
<code>{versionInformation.version}</code>
|
|
35
|
+
</div>
|
|
36
|
+
)}
|
|
36
37
|
<div className={styles.name}>{name}</div>
|
|
37
38
|
<div>Type: {versionInformation.type}</div>
|
|
38
39
|
</li>
|
|
@@ -42,5 +43,3 @@ function DebugMetadata() {
|
|
|
42
43
|
</DebugLayout>
|
|
43
44
|
);
|
|
44
45
|
}
|
|
45
|
-
|
|
46
|
-
export default DebugMetadata;
|