@docusaurus/plugin-debug 2.0.0-beta.15d451942 → 2.0.0-beta.16

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 (38) hide show
  1. package/lib/index.d.ts +1 -1
  2. package/lib/index.js +13 -10
  3. package/lib/theme/DebugConfig/index.d.ts +8 -0
  4. package/lib/theme/DebugConfig/index.js +20 -0
  5. package/lib/theme/DebugContent/index.d.ts +9 -0
  6. package/lib/theme/DebugContent/index.js +34 -0
  7. package/lib/theme/DebugGlobalData/index.d.ts +8 -0
  8. package/lib/theme/DebugGlobalData/index.js +20 -0
  9. package/lib/theme/DebugJsonView/index.d.ts +9 -0
  10. package/lib/theme/DebugJsonView/index.js +35 -0
  11. package/lib/theme/DebugLayout/index.d.ts +10 -0
  12. package/lib/theme/DebugLayout/index.js +34 -0
  13. package/lib/theme/DebugLayout/styles.module.css +75 -0
  14. package/lib/theme/DebugRegistry/index.d.ts +8 -0
  15. package/lib/theme/DebugRegistry/index.js +25 -0
  16. package/lib/theme/DebugRegistry/styles.module.css +18 -0
  17. package/lib/theme/DebugRoutes/index.d.ts +8 -0
  18. package/lib/theme/DebugRoutes/index.js +28 -0
  19. package/lib/theme/DebugRoutes/styles.module.css +26 -0
  20. package/lib/theme/DebugSiteMetadata/index.d.ts +8 -0
  21. package/lib/theme/DebugSiteMetadata/index.js +35 -0
  22. package/lib/theme/DebugSiteMetadata/styles.module.css +31 -0
  23. package/package.json +13 -9
  24. package/src/index.ts +4 -1
  25. package/src/plugin-debug.d.ts +53 -0
  26. package/src/theme/DebugConfig/{index.js → index.tsx} +4 -6
  27. package/src/theme/DebugContent/index.tsx +79 -0
  28. package/src/theme/DebugGlobalData/{index.js → index.tsx} +4 -6
  29. package/src/theme/DebugJsonView/{index.js → index.tsx} +15 -13
  30. package/src/theme/DebugLayout/{index.js → index.tsx} +20 -16
  31. package/src/theme/DebugLayout/styles.module.css +1 -1
  32. package/src/theme/DebugRegistry/{index.js → index.tsx} +2 -4
  33. package/src/theme/DebugRoutes/{index.js → index.tsx} +3 -5
  34. package/src/theme/DebugRoutes/styles.module.css +1 -1
  35. package/src/theme/DebugSiteMetadata/{index.js → index.tsx} +8 -9
  36. package/lib/.tsbuildinfo +0 -3939
  37. package/src/theme/DebugContent/index.js +0 -70
  38. package/tsconfig.json +0 -9
package/lib/index.d.ts CHANGED
@@ -4,5 +4,5 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { LoadContext, Plugin } from '@docusaurus/types';
7
+ import type { LoadContext, Plugin } from '@docusaurus/types';
8
8
  export default function pluginDebug({ siteConfig: { baseUrl }, generatedFilesDir, }: LoadContext): Plugin<void>;
package/lib/index.js CHANGED
@@ -8,48 +8,51 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  const tslib_1 = require("tslib");
10
10
  const utils_1 = require("@docusaurus/utils");
11
- const path_1 = tslib_1.__importDefault(require("path"));
11
+ const path_1 = (0, tslib_1.__importDefault)(require("path"));
12
12
  function pluginDebug({ siteConfig: { baseUrl }, generatedFilesDir, }) {
13
13
  const pluginDataDirRoot = path_1.default.join(generatedFilesDir, 'docusaurus-plugin-debug');
14
- const aliasedSource = (source) => `~debug/${utils_1.posixPath(path_1.default.relative(pluginDataDirRoot, source))}`;
14
+ const aliasedSource = (source) => `~debug/${(0, utils_1.posixPath)(path_1.default.relative(pluginDataDirRoot, source))}`;
15
15
  return {
16
16
  name: 'docusaurus-plugin-debug',
17
17
  getThemePath() {
18
+ return path_1.default.resolve(__dirname, '../lib/theme');
19
+ },
20
+ getTypeScriptThemePath() {
18
21
  return path_1.default.resolve(__dirname, '../src/theme');
19
22
  },
20
23
  async contentLoaded({ actions: { createData, addRoute }, allContent }) {
21
24
  const allContentPath = await createData(
22
25
  // Note that this created data path must be in sync with
23
26
  // metadataPath provided to mdx-loader.
24
- `${utils_1.docuHash('docusaurus-debug-allContent')}.json`, JSON.stringify(allContent, null, 2));
27
+ `${(0, utils_1.docuHash)('docusaurus-debug-allContent')}.json`, JSON.stringify(allContent, null, 2));
25
28
  // Home is config (duplicate for now)
26
29
  addRoute({
27
- path: utils_1.normalizeUrl([baseUrl, '__docusaurus/debug']),
30
+ path: (0, utils_1.normalizeUrl)([baseUrl, '__docusaurus/debug']),
28
31
  component: '@theme/DebugConfig',
29
32
  exact: true,
30
33
  });
31
34
  addRoute({
32
- path: utils_1.normalizeUrl([baseUrl, '__docusaurus/debug/config']),
35
+ path: (0, utils_1.normalizeUrl)([baseUrl, '__docusaurus/debug/config']),
33
36
  component: '@theme/DebugConfig',
34
37
  exact: true,
35
38
  });
36
39
  addRoute({
37
- path: utils_1.normalizeUrl([baseUrl, '__docusaurus/debug/metadata']),
40
+ path: (0, utils_1.normalizeUrl)([baseUrl, '__docusaurus/debug/metadata']),
38
41
  component: '@theme/DebugSiteMetadata',
39
42
  exact: true,
40
43
  });
41
44
  addRoute({
42
- path: utils_1.normalizeUrl([baseUrl, '__docusaurus/debug/registry']),
45
+ path: (0, utils_1.normalizeUrl)([baseUrl, '__docusaurus/debug/registry']),
43
46
  component: '@theme/DebugRegistry',
44
47
  exact: true,
45
48
  });
46
49
  addRoute({
47
- path: utils_1.normalizeUrl([baseUrl, '__docusaurus/debug/routes']),
50
+ path: (0, utils_1.normalizeUrl)([baseUrl, '__docusaurus/debug/routes']),
48
51
  component: '@theme/DebugRoutes',
49
52
  exact: true,
50
53
  });
51
54
  addRoute({
52
- path: utils_1.normalizeUrl([baseUrl, '__docusaurus/debug/content']),
55
+ path: (0, utils_1.normalizeUrl)([baseUrl, '__docusaurus/debug/content']),
53
56
  component: '@theme/DebugContent',
54
57
  exact: true,
55
58
  modules: {
@@ -57,7 +60,7 @@ function pluginDebug({ siteConfig: { baseUrl }, generatedFilesDir, }) {
57
60
  },
58
61
  });
59
62
  addRoute({
60
- path: utils_1.normalizeUrl([baseUrl, '__docusaurus/debug/globalData']),
63
+ path: (0, utils_1.normalizeUrl)([baseUrl, '__docusaurus/debug/globalData']),
61
64
  component: '@theme/DebugGlobalData',
62
65
  exact: true,
63
66
  });
@@ -0,0 +1,8 @@
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
+ export default function DebugMetadata(): JSX.Element;
@@ -0,0 +1,20 @@
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 useDocusaurusContext_1 = (0, tslib_1.__importDefault)(require("@docusaurus/useDocusaurusContext"));
14
+ function DebugMetadata() {
15
+ const { siteConfig } = (0, useDocusaurusContext_1.default)();
16
+ return (react_1.default.createElement(DebugLayout_1.default, null,
17
+ react_1.default.createElement("h2", null, "Site config"),
18
+ react_1.default.createElement(DebugJsonView_1.default, { src: siteConfig, collapseDepth: 3 })));
19
+ }
20
+ exports.default = DebugMetadata;
@@ -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
+ import type { Props } from '@theme/DebugContent';
9
+ export default function DebugContent({ allContent }: Props): JSX.Element;
@@ -0,0 +1,34 @@
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
+ function PluginInstanceContent({ pluginId, pluginInstanceContent, }) {
14
+ return (react_1.default.createElement("section", { style: { marginBottom: 30 } },
15
+ react_1.default.createElement("code", null, pluginId),
16
+ react_1.default.createElement(DebugJsonView_1.default, { src: pluginInstanceContent, collapseDepth: 2 })));
17
+ }
18
+ function PluginContent({ pluginName, pluginContent, }) {
19
+ return (react_1.default.createElement("section", { style: { marginBottom: 60 } },
20
+ react_1.default.createElement("h3", null, pluginName),
21
+ react_1.default.createElement("div", null, Object.entries(pluginContent)
22
+ // filter plugin instances with no content
23
+ .filter(([_pluginId, pluginInstanceContent]) => !!pluginInstanceContent)
24
+ .map(([pluginId, pluginInstanceContent]) => (react_1.default.createElement(PluginInstanceContent, { key: pluginId, pluginId: pluginId, pluginInstanceContent: pluginInstanceContent }))))));
25
+ }
26
+ function DebugContent({ allContent }) {
27
+ return (react_1.default.createElement(DebugLayout_1.default, null,
28
+ react_1.default.createElement("h2", null, "Plugin content"),
29
+ react_1.default.createElement("div", null, Object.entries(allContent)
30
+ // filter plugins with no content
31
+ .filter(([_pluginName, pluginContent]) => Object.values(pluginContent).some((instanceContent) => !!instanceContent))
32
+ .map(([pluginName, pluginContent]) => (react_1.default.createElement(PluginContent, { key: pluginName, pluginName: pluginName, pluginContent: pluginContent }))))));
33
+ }
34
+ exports.default = DebugContent;
@@ -0,0 +1,8 @@
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
+ export default function DebugMetadata(): JSX.Element;
@@ -0,0 +1,20 @@
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 useGlobalData_1 = (0, tslib_1.__importDefault)(require("@docusaurus/useGlobalData"));
14
+ function DebugMetadata() {
15
+ const globalData = (0, useGlobalData_1.default)();
16
+ return (react_1.default.createElement(DebugLayout_1.default, null,
17
+ react_1.default.createElement("h2", null, "Global data"),
18
+ react_1.default.createElement(DebugJsonView_1.default, { src: globalData, collapseDepth: 3 })));
19
+ }
20
+ exports.default = DebugMetadata;
@@ -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
+ import type { Props } from '@theme/DebugJsonView';
9
+ export default function DebugJsonView({ src, collapseDepth, }: Props): JSX.Element;
@@ -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 BrowserOnly_1 = (0, tslib_1.__importDefault)(require("@docusaurus/BrowserOnly"));
12
+ // avoids "react-json-view" to display "root"
13
+ const RootName = null;
14
+ // Seems ReactJson does not work with SSR
15
+ // https://github.com/mac-s-g/react-json-view/issues/121
16
+ function BrowserOnlyReactJson(props) {
17
+ return (react_1.default.createElement(BrowserOnly_1.default, null, () => {
18
+ // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
19
+ const ReactJson = require('react-json-view').default;
20
+ return react_1.default.createElement(ReactJson, { ...props });
21
+ }));
22
+ }
23
+ function DebugJsonView({ src, collapseDepth, }) {
24
+ return (react_1.default.createElement(BrowserOnlyReactJson, { src: src, style: {
25
+ marginTop: '10px',
26
+ padding: '10px',
27
+ borderRadius: '4px',
28
+ backgroundColor: '#292a2b',
29
+ }, name: RootName, theme: "paraiso", shouldCollapse: (field) =>
30
+ // By default, we collapse the json for performance reasons
31
+ // See https://github.com/mac-s-g/react-json-view/issues/235
32
+ // Non-root elements that are larger than 50 fields are collapsed
33
+ field.name !== RootName && Object.keys(field.src).length > 50, collapsed: collapseDepth, groupArraysAfterLength: 5, enableClipboard: false, displayDataTypes: false }));
34
+ }
35
+ exports.default = DebugJsonView;
@@ -0,0 +1,10 @@
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
+ import { type ReactNode } from 'react';
8
+ export default function DebugLayout({ children, }: {
9
+ children: ReactNode;
10
+ }): JSX.Element;
@@ -0,0 +1,34 @@
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
+ function DebugNavLink({ to, children }) {
15
+ return (react_1.default.createElement(Link_1.default, { className: styles_module_css_1.default.navlink, isNavLink: true, to: to, exact: true, activeStyle: {
16
+ backgroundColor: '#363739',
17
+ } }, children));
18
+ }
19
+ function DebugLayout({ children, }) {
20
+ return (react_1.default.createElement(react_1.default.Fragment, null,
21
+ react_1.default.createElement(Head_1.default, null,
22
+ react_1.default.createElement("html", { lang: "en" }),
23
+ react_1.default.createElement("title", null, "Docusaurus debug panel")),
24
+ react_1.default.createElement("div", null,
25
+ react_1.default.createElement("nav", { className: styles_module_css_1.default.nav },
26
+ react_1.default.createElement(DebugNavLink, { to: "/__docusaurus/debug" }, "Config"),
27
+ react_1.default.createElement(DebugNavLink, { to: "/__docusaurus/debug/metadata" }, "Metadata"),
28
+ react_1.default.createElement(DebugNavLink, { to: "/__docusaurus/debug/registry" }, "Registry"),
29
+ react_1.default.createElement(DebugNavLink, { to: "/__docusaurus/debug/routes" }, "Routes"),
30
+ react_1.default.createElement(DebugNavLink, { to: "/__docusaurus/debug/content" }, "Content"),
31
+ react_1.default.createElement(DebugNavLink, { to: "/__docusaurus/debug/globalData" }, "Global data")),
32
+ react_1.default.createElement("main", { className: styles_module_css_1.default.container }, children))));
33
+ }
34
+ 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;
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,8 @@
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
+ export default function DebugRegistry(): JSX.Element;
@@ -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,8 @@
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
+ export default function DebugRoutes(): JSX.Element;
@@ -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,8 @@
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
+ export default function DebugMetadata(): JSX.Element;
@@ -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.15d451942",
3
+ "version": "2.0.0-beta.16",
4
4
  "description": "Debug plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
+ "types": "src/plugin-debug.d.ts",
6
7
  "scripts": {
7
- "build": "tsc",
8
- "watch": "tsc --watch"
8
+ "build": "tsc && node copyUntypedFiles.mjs",
9
+ "watch": "node copyUntypedFiles.mjs && tsc --watch"
9
10
  },
10
11
  "publishConfig": {
11
12
  "access": "public"
@@ -17,18 +18,21 @@
17
18
  },
18
19
  "license": "MIT",
19
20
  "dependencies": {
20
- "@docusaurus/core": "2.0.0-beta.15d451942",
21
- "@docusaurus/types": "2.0.0-beta.15d451942",
22
- "@docusaurus/utils": "2.0.0-beta.15d451942",
21
+ "@docusaurus/core": "2.0.0-beta.16",
22
+ "@docusaurus/utils": "2.0.0-beta.16",
23
+ "fs-extra": "^10.0.1",
23
24
  "react-json-view": "^1.21.3",
24
- "tslib": "^2.1.0"
25
+ "tslib": "^2.3.1"
26
+ },
27
+ "devDependencies": {
28
+ "@docusaurus/types": "2.0.0-beta.16"
25
29
  },
26
30
  "peerDependencies": {
27
31
  "react": "^16.8.4 || ^17.0.0",
28
32
  "react-dom": "^16.8.4 || ^17.0.0"
29
33
  },
30
34
  "engines": {
31
- "node": ">=12.13.0"
35
+ "node": ">=14"
32
36
  },
33
- "gitHead": "dfceae8bd3e8b42ba8fc14f1449d861046c26143"
37
+ "gitHead": "eb43c4d4f95a4fb97dc9bb9dc615413e0dc2e1e7"
34
38
  }
package/src/index.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import {LoadContext, Plugin} from '@docusaurus/types';
8
+ import type {LoadContext, Plugin} from '@docusaurus/types';
9
9
  import {docuHash, normalizeUrl, posixPath} from '@docusaurus/utils';
10
10
  import path from 'path';
11
11
 
@@ -24,6 +24,9 @@ export default function pluginDebug({
24
24
  name: 'docusaurus-plugin-debug',
25
25
 
26
26
  getThemePath() {
27
+ return path.resolve(__dirname, '../lib/theme');
28
+ },
29
+ getTypeScriptThemePath() {
27
30
  return path.resolve(__dirname, '../src/theme');
28
31
  },
29
32