@docusaurus/plugin-debug 2.0.0-beta.7fe2a9891 → 2.0.0-beta.8

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.
Files changed (34) hide show
  1. package/copyUntypedFiles.js +20 -0
  2. package/lib/.tsbuildinfo +1 -1
  3. package/lib/index.js +11 -11
  4. package/lib/theme/DebugConfig/index.d.ts +9 -0
  5. package/lib/theme/DebugConfig/index.js +20 -0
  6. package/lib/theme/DebugContent/index.d.ts +10 -0
  7. package/lib/theme/DebugContent/index.js +36 -0
  8. package/lib/theme/DebugGlobalData/index.d.ts +9 -0
  9. package/lib/theme/DebugGlobalData/index.js +20 -0
  10. package/lib/theme/DebugJsonView/index.d.ts +10 -0
  11. package/lib/theme/DebugJsonView/index.js +42 -0
  12. package/lib/theme/DebugLayout/index.d.ts +11 -0
  13. package/lib/theme/DebugLayout/index.js +32 -0
  14. package/lib/theme/DebugLayout/styles.module.css +75 -0
  15. package/lib/theme/DebugRegistry/index.d.ts +9 -0
  16. package/lib/theme/DebugRegistry/index.js +25 -0
  17. package/lib/theme/DebugRegistry/styles.module.css +18 -0
  18. package/lib/theme/DebugRoutes/index.d.ts +9 -0
  19. package/lib/theme/DebugRoutes/index.js +28 -0
  20. package/lib/theme/DebugRoutes/styles.module.css +26 -0
  21. package/lib/theme/DebugSiteMetadata/index.d.ts +9 -0
  22. package/lib/theme/DebugSiteMetadata/index.js +35 -0
  23. package/lib/theme/DebugSiteMetadata/styles.module.css +31 -0
  24. package/package.json +10 -8
  25. package/src/index.ts +1 -1
  26. package/src/theme/DebugConfig/{index.js → index.tsx} +4 -4
  27. package/src/theme/DebugContent/{index.js → index.tsx} +19 -6
  28. package/src/theme/DebugGlobalData/{index.js → index.tsx} +4 -4
  29. package/src/theme/DebugJsonView/{index.js → index.tsx} +10 -7
  30. package/src/theme/DebugLayout/{index.js → index.tsx} +3 -3
  31. package/src/theme/DebugRegistry/{index.js → index.tsx} +2 -2
  32. package/src/theme/DebugRoutes/{index.js → index.tsx} +3 -3
  33. package/src/theme/DebugSiteMetadata/{index.js → index.tsx} +8 -7
  34. package/src/types.d.ts +51 -0
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Facebook, Inc. and its affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ const tslib_1 = require("tslib");
10
+ const react_1 = (0, tslib_1.__importDefault)(require("react"));
11
+ const Head_1 = (0, tslib_1.__importDefault)(require("@docusaurus/Head"));
12
+ const Link_1 = (0, tslib_1.__importDefault)(require("@docusaurus/Link"));
13
+ const styles_module_css_1 = (0, tslib_1.__importDefault)(require("./styles.module.css"));
14
+ const DebugNavLink = ({ to, children }) => (react_1.default.createElement(Link_1.default, { className: styles_module_css_1.default.navlink, isNavLink: true, to: to, exact: true, activeStyle: {
15
+ backgroundColor: '#363739',
16
+ } }, children));
17
+ function DebugLayout({ children }) {
18
+ return (react_1.default.createElement(react_1.default.Fragment, null,
19
+ react_1.default.createElement(Head_1.default, null,
20
+ react_1.default.createElement("html", { lang: "en" }),
21
+ react_1.default.createElement("title", null, "Docusaurus debug panel")),
22
+ react_1.default.createElement("div", null,
23
+ react_1.default.createElement("nav", { className: styles_module_css_1.default.nav },
24
+ react_1.default.createElement(DebugNavLink, { to: "/__docusaurus/debug" }, "Config"),
25
+ react_1.default.createElement(DebugNavLink, { to: "/__docusaurus/debug/metadata" }, "Metadata"),
26
+ react_1.default.createElement(DebugNavLink, { to: "/__docusaurus/debug/registry" }, "Registry"),
27
+ react_1.default.createElement(DebugNavLink, { to: "/__docusaurus/debug/routes" }, "Routes"),
28
+ react_1.default.createElement(DebugNavLink, { to: "/__docusaurus/debug/content" }, "Content"),
29
+ react_1.default.createElement(DebugNavLink, { to: "/__docusaurus/debug/globalData" }, "Global data")),
30
+ react_1.default.createElement("main", { className: styles_module_css_1.default.container }, children))));
31
+ }
32
+ exports.default = DebugLayout;
@@ -0,0 +1,75 @@
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
+ .container {
9
+ padding: 20px;
10
+ padding-top: 80px;
11
+ overflow-x: hidden;
12
+ background-color: #18191a;
13
+ color: white;
14
+ min-height: 100vh;
15
+ }
16
+
17
+ .container code {
18
+ color: white;
19
+ background-color: #444950;
20
+ }
21
+
22
+ .nav {
23
+ position: fixed;
24
+ display: flex;
25
+ justify-content: space-evenly;
26
+ align-items: center;
27
+ height: 3.75rem;
28
+ background-color: #242526;
29
+ width: 100%;
30
+ z-index: 1;
31
+ }
32
+
33
+ .navlink {
34
+ color: white;
35
+ font-weight: 500;
36
+ font-size: clamp(12px, 4vw, 16px);
37
+ text-align: center;
38
+ border-radius: 4px;
39
+ padding: 6px 6px;
40
+ }
41
+
42
+ .navlink:hover {
43
+ text-decoration: none;
44
+ background-color: #292a2b;
45
+ }
46
+
47
+ .active {
48
+ background-color: #363739;
49
+ }
50
+
51
+ @media screen and (min-width: 800px) {
52
+ .nav {
53
+ flex-direction: column;
54
+ justify-content: flex-start;
55
+ align-items: center;
56
+ height: 100vh;
57
+ width: 200px;
58
+ float: left;
59
+ background-color: #18191a;
60
+ border-right: 1px solid #606770;
61
+ padding-top: 20px;
62
+ }
63
+
64
+ .navlink {
65
+ width: 80%;
66
+ margin-top: 20px;
67
+ text-align: left;
68
+ }
69
+
70
+ .container {
71
+ padding-top: 40px;
72
+ float: right;
73
+ width: calc(100% - 200px);
74
+ }
75
+ }
@@ -0,0 +1,9 @@
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
+ /// <reference types="react" />
8
+ declare function DebugRegistry(): JSX.Element;
9
+ export default DebugRegistry;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Facebook, Inc. and its affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ const tslib_1 = require("tslib");
10
+ const react_1 = (0, tslib_1.__importDefault)(require("react"));
11
+ const DebugLayout_1 = (0, tslib_1.__importDefault)(require("@theme/DebugLayout"));
12
+ const registry_1 = (0, tslib_1.__importDefault)(require("@generated/registry"));
13
+ const styles_module_css_1 = (0, tslib_1.__importDefault)(require("./styles.module.css"));
14
+ function DebugRegistry() {
15
+ return (react_1.default.createElement(DebugLayout_1.default, null,
16
+ react_1.default.createElement("h2", null, "Registry"),
17
+ react_1.default.createElement("ul", { className: styles_module_css_1.default.list }, Object.values(registry_1.default).map(([, aliasedPath, resolved]) => (react_1.default.createElement("li", { key: aliasedPath, className: styles_module_css_1.default.listItem },
18
+ react_1.default.createElement("div", { style: { marginBottom: '10px' } },
19
+ "Aliased Path: ",
20
+ react_1.default.createElement("code", null, aliasedPath)),
21
+ react_1.default.createElement("div", null,
22
+ "Resolved Path: ",
23
+ react_1.default.createElement("code", null, resolved))))))));
24
+ }
25
+ exports.default = DebugRegistry;
@@ -0,0 +1,18 @@
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
+ .list {
9
+ padding: 0;
10
+ }
11
+
12
+ .listItem {
13
+ list-style: none;
14
+ background-color: #242526;
15
+ padding: 10px;
16
+ border-radius: 4px;
17
+ margin-bottom: 20px;
18
+ }
@@ -0,0 +1,9 @@
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
+ /// <reference types="react" />
8
+ declare function DebugRoutes(): JSX.Element;
9
+ export default DebugRoutes;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Facebook, Inc. and its affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ const tslib_1 = require("tslib");
10
+ const react_1 = (0, tslib_1.__importDefault)(require("react"));
11
+ const DebugLayout_1 = (0, tslib_1.__importDefault)(require("@theme/DebugLayout"));
12
+ const DebugJsonView_1 = (0, tslib_1.__importDefault)(require("@theme/DebugJsonView"));
13
+ const routes_1 = (0, tslib_1.__importDefault)(require("@generated/routes"));
14
+ const styles_module_css_1 = (0, tslib_1.__importDefault)(require("./styles.module.css"));
15
+ function DebugRoutes() {
16
+ return (react_1.default.createElement(DebugLayout_1.default, null,
17
+ react_1.default.createElement("h2", null, "Routes"),
18
+ react_1.default.createElement("ul", { className: styles_module_css_1.default.list }, routes_1.default.map(({ path, exact, routes: childRoutes }) => (react_1.default.createElement("li", { key: path, className: styles_module_css_1.default.listItem },
19
+ react_1.default.createElement("div", { className: styles_module_css_1.default.route },
20
+ react_1.default.createElement("code", { className: styles_module_css_1.default.routeName }, path)),
21
+ react_1.default.createElement("div", null,
22
+ "Is exact: ",
23
+ react_1.default.createElement("code", null, String(Boolean(exact)))),
24
+ childRoutes && (react_1.default.createElement("div", null,
25
+ "Child Routes:",
26
+ react_1.default.createElement(DebugJsonView_1.default, { src: childRoutes })))))))));
27
+ }
28
+ exports.default = DebugRoutes;
@@ -0,0 +1,26 @@
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
+ .list {
9
+ padding: 0;
10
+ }
11
+
12
+ .listItem {
13
+ list-style: none;
14
+ background-color: #242526;
15
+ padding: 10px;
16
+ border-radius: 4px;
17
+ margin-bottom: 20px;
18
+ }
19
+
20
+ .route {
21
+ margin-bottom: 10px;
22
+ }
23
+
24
+ .routeName {
25
+ color: #e06b6b;
26
+ }
@@ -0,0 +1,9 @@
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
+ /// <reference types="react" />
8
+ declare function DebugMetadata(): JSX.Element;
9
+ export default DebugMetadata;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Facebook, Inc. and its affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ const tslib_1 = require("tslib");
10
+ const react_1 = (0, tslib_1.__importDefault)(require("react"));
11
+ const DebugLayout_1 = (0, tslib_1.__importDefault)(require("@theme/DebugLayout"));
12
+ const useDocusaurusContext_1 = (0, tslib_1.__importDefault)(require("@docusaurus/useDocusaurusContext"));
13
+ const styles_module_css_1 = (0, tslib_1.__importDefault)(require("./styles.module.css"));
14
+ function DebugMetadata() {
15
+ const { siteMetadata } = (0, useDocusaurusContext_1.default)();
16
+ return (react_1.default.createElement(DebugLayout_1.default, null,
17
+ react_1.default.createElement("h2", null, "Site Metadata"),
18
+ react_1.default.createElement("div", null,
19
+ "Docusaurus Version: ",
20
+ react_1.default.createElement("code", null, siteMetadata.docusaurusVersion)),
21
+ react_1.default.createElement("div", null,
22
+ "Site Version:",
23
+ ' ',
24
+ react_1.default.createElement("code", null, siteMetadata.siteVersion || 'No version specified')),
25
+ react_1.default.createElement("h3", { className: styles_module_css_1.default.sectionTitle }, "Plugins and themes"),
26
+ react_1.default.createElement("ul", { className: styles_module_css_1.default.list }, Object.entries(siteMetadata.pluginVersions).map(([name, versionInformation]) => (react_1.default.createElement("li", { key: name, className: styles_module_css_1.default.listItem },
27
+ versionInformation.type === 'package' &&
28
+ versionInformation.version && (react_1.default.createElement("div", { className: styles_module_css_1.default.version },
29
+ react_1.default.createElement("code", null, versionInformation.version))),
30
+ react_1.default.createElement("div", { className: styles_module_css_1.default.name }, name),
31
+ react_1.default.createElement("div", null,
32
+ "Type: ",
33
+ versionInformation.type)))))));
34
+ }
35
+ exports.default = DebugMetadata;
@@ -0,0 +1,31 @@
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
+ .sectionTitle {
9
+ margin-top: 20px;
10
+ }
11
+
12
+ .list {
13
+ padding: 0;
14
+ }
15
+
16
+ .listItem {
17
+ list-style: none;
18
+ background-color: #242526;
19
+ padding: 10px;
20
+ border-radius: 4px;
21
+ margin-bottom: 20px;
22
+ }
23
+
24
+ .version {
25
+ float: right;
26
+ }
27
+
28
+ .name {
29
+ font-weight: 800;
30
+ color: #e06b6b;
31
+ }
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-debug",
3
- "version": "2.0.0-beta.7fe2a9891",
3
+ "version": "2.0.0-beta.8",
4
4
  "description": "Debug plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
+ "types": "src/types.d.ts",
6
7
  "scripts": {
7
- "build": "tsc",
8
- "watch": "tsc --watch"
8
+ "build": "tsc && node copyUntypedFiles.js",
9
+ "watch": "node copyUntypedFiles.js && tsc --watch"
9
10
  },
10
11
  "publishConfig": {
11
12
  "access": "public"
@@ -17,11 +18,12 @@
17
18
  },
18
19
  "license": "MIT",
19
20
  "dependencies": {
20
- "@docusaurus/core": "2.0.0-beta.7fe2a9891",
21
- "@docusaurus/types": "2.0.0-beta.7fe2a9891",
22
- "@docusaurus/utils": "2.0.0-beta.7fe2a9891",
21
+ "@docusaurus/core": "2.0.0-beta.8",
22
+ "@docusaurus/types": "2.0.0-beta.8",
23
+ "@docusaurus/utils": "2.0.0-beta.8",
24
+ "fs-extra": "^10.0.0",
23
25
  "react-json-view": "^1.21.3",
24
- "tslib": "^2.1.0"
26
+ "tslib": "^2.3.1"
25
27
  },
26
28
  "peerDependencies": {
27
29
  "react": "^16.8.4 || ^17.0.0",
@@ -30,5 +32,5 @@
30
32
  "engines": {
31
33
  "node": ">=12.13.0"
32
34
  },
33
- "gitHead": "16fc4ca84eed792089c77e73584de1e6e0cf0e67"
35
+ "gitHead": "4f9b8d76d1eab9f20ddfad9865a1388ea2ce1c9c"
34
36
  }
package/src/index.ts CHANGED
@@ -24,7 +24,7 @@ export default function pluginDebug({
24
24
  name: 'docusaurus-plugin-debug',
25
25
 
26
26
  getThemePath() {
27
- return path.resolve(__dirname, '../src/theme');
27
+ return path.resolve(__dirname, '../lib/theme');
28
28
  },
29
29
 
30
30
  async contentLoaded({actions: {createData, addRoute}, allContent}) {
@@ -7,17 +7,17 @@
7
7
 
8
8
  import React from 'react';
9
9
 
10
- import DebugLayout from '../DebugLayout';
11
- import DebugJsonView from '../DebugJsonView';
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
+ 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="3" />
20
+ <DebugJsonView src={siteConfig} collapseDepth={3} />
21
21
  </DebugLayout>
22
22
  );
23
23
  }
@@ -7,17 +7,30 @@
7
7
 
8
8
  import React from 'react';
9
9
 
10
- import DebugLayout from '../DebugLayout';
11
- import DebugJsonView from '../DebugJsonView';
10
+ import DebugLayout from '@theme/DebugLayout';
11
+ import DebugJsonView from '@theme/DebugJsonView';
12
+ import type {Props} from '@theme/DebugContent';
12
13
 
13
- const PluginInstanceContent = ({pluginId, pluginInstanceContent}) => (
14
+ const PluginInstanceContent = ({
15
+ pluginId,
16
+ pluginInstanceContent,
17
+ }: {
18
+ pluginId: string;
19
+ pluginInstanceContent: unknown;
20
+ }) => (
14
21
  <section style={{marginBottom: 30}}>
15
22
  <code>{pluginId}</code>
16
- <DebugJsonView src={pluginInstanceContent} collapseDepth="2" />
23
+ <DebugJsonView src={pluginInstanceContent} collapseDepth={2} />
17
24
  </section>
18
25
  );
19
26
 
20
- const PluginContent = ({pluginName, pluginContent}) => {
27
+ const PluginContent = ({
28
+ pluginName,
29
+ pluginContent,
30
+ }: {
31
+ pluginName: string;
32
+ pluginContent: Record<string, unknown>;
33
+ }) => {
21
34
  return (
22
35
  <section style={{marginBottom: 60}}>
23
36
  <h3>{pluginName}</h3>
@@ -41,7 +54,7 @@ const PluginContent = ({pluginName, pluginContent}) => {
41
54
  );
42
55
  };
43
56
 
44
- function DebugContent({allContent}) {
57
+ function DebugContent({allContent}: Props): JSX.Element {
45
58
  return (
46
59
  <DebugLayout>
47
60
  <h2>Plugin content</h2>
@@ -7,16 +7,16 @@
7
7
 
8
8
  import React from 'react';
9
9
 
10
- import DebugLayout from '../DebugLayout';
11
- import DebugJsonView from '../DebugJsonView';
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
+ 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="3" />
19
+ <DebugJsonView src={globalData} collapseDepth={3} />
20
20
  </DebugLayout>
21
21
  );
22
22
  }
@@ -6,19 +6,20 @@
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
  // avoids "react-json-view" to display "root"
13
- const RootName = false;
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
- const BrowserOnlyReactJson = (props) => {
18
+ const 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
  }}
@@ -26,10 +27,12 @@ const BrowserOnlyReactJson = (props) => {
26
27
  );
27
28
  };
28
29
 
29
- function DebugJsonView({src, collapseDepth}) {
30
+ function DebugJsonView({src, collapseDepth}: Props): JSX.Element {
30
31
  return (
31
32
  <BrowserOnlyReactJson
32
- src={src}
33
+ // Prop type defined by react-json-view
34
+ // eslint-disable-next-line @typescript-eslint/ban-types
35
+ src={src as object}
33
36
  style={{
34
37
  marginTop: '10px',
35
38
  padding: '10px',
@@ -45,7 +48,7 @@ function DebugJsonView({src, collapseDepth}) {
45
48
  return field.name !== RootName && Object.keys(field.src).length > 50;
46
49
  }}
47
50
  collapsed={collapseDepth}
48
- groupArraysAfterLength="5"
51
+ groupArraysAfterLength={5}
49
52
  enableClipboard={false}
50
53
  displayDataTypes={false}
51
54
  />
@@ -5,12 +5,12 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import React from 'react';
8
+ import React, {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
- const DebugNavLink = ({to, children}) => (
13
+ const DebugNavLink = ({to, children}: {to: string; children: ReactNode}) => (
14
14
  <Link
15
15
  className={styles.navlink}
16
16
  isNavLink
@@ -23,7 +23,7 @@ const DebugNavLink = ({to, children}) => (
23
23
  </Link>
24
24
  );
25
25
 
26
- function DebugLayout({children}) {
26
+ function DebugLayout({children}: {children: ReactNode}): JSX.Element {
27
27
  return (
28
28
  <>
29
29
  <Head>
@@ -7,11 +7,11 @@
7
7
 
8
8
  import React from 'react';
9
9
 
10
- import DebugLayout from '../DebugLayout';
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
+ function DebugRegistry(): JSX.Element {
15
15
  return (
16
16
  <DebugLayout>
17
17
  <h2>Registry</h2>
@@ -7,12 +7,12 @@
7
7
 
8
8
  import React from 'react';
9
9
 
10
- import DebugLayout from '../DebugLayout';
11
- import DebugJsonView from '../DebugJsonView';
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
+ function DebugRoutes(): JSX.Element {
16
16
  return (
17
17
  <DebugLayout>
18
18
  <h2>Routes</h2>
@@ -7,11 +7,11 @@
7
7
 
8
8
  import React from 'react';
9
9
 
10
- import DebugLayout from '../DebugLayout';
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
+ function DebugMetadata(): JSX.Element {
15
15
  const {siteMetadata} = useDocusaurusContext();
16
16
  return (
17
17
  <DebugLayout>
@@ -28,11 +28,12 @@ function DebugMetadata() {
28
28
  {Object.entries(siteMetadata.pluginVersions).map(
29
29
  ([name, versionInformation]) => (
30
30
  <li key={name} className={styles.listItem}>
31
- {versionInformation.version && (
32
- <div className={styles.version}>
33
- <code>{versionInformation.version}</code>
34
- </div>
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>
package/src/types.d.ts ADDED
@@ -0,0 +1,51 @@
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 '@theme/DebugConfig' {
11
+ export default function DebugMetadata(): JSX.Element;
12
+ }
13
+
14
+ declare module '@theme/DebugContent' {
15
+ import type {AllContent} from '@docusaurus/types';
16
+
17
+ export interface Props {
18
+ readonly allContent: AllContent;
19
+ }
20
+ export default function DebugContent(props: Props): JSX.Element;
21
+ }
22
+
23
+ declare module '@theme/DebugGlobalData' {
24
+ export default function DebugGlobalData(): JSX.Element;
25
+ }
26
+
27
+ declare module '@theme/DebugJsonView' {
28
+ export interface Props {
29
+ readonly src: unknown;
30
+ readonly collapseDepth?: number;
31
+ }
32
+ export default function DebugJsonView(props: Props): JSX.Element;
33
+ }
34
+
35
+ declare module '@theme/DebugLayout' {
36
+ export default function DebugLayout(props: {
37
+ children: ReactNode;
38
+ }): JSX.Element;
39
+ }
40
+
41
+ declare module '@theme/DebugRegistry' {
42
+ export default function DebugRegistry(): JSX.Element;
43
+ }
44
+
45
+ declare module '@theme/DebugRoutes' {
46
+ export default function DebugRoutes(): JSX.Element;
47
+ }
48
+
49
+ declare module '@theme/DebugSiteMetadata' {
50
+ export default function DebugSiteMetadata(): JSX.Element;
51
+ }