-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add multiple debug pages + debug layout - ability to debug plugin contentLoaded data
- Loading branch information
Showing
24 changed files
with
325 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
packages/docusaurus-plugin-debug/src/theme/DebugConfig/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import DebugLayout from '../DebugLayout'; | ||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; | ||
|
||
function DebugMetadata() { | ||
const {siteConfig} = useDocusaurusContext(); | ||
return ( | ||
<DebugLayout> | ||
<h2>Site config</h2> | ||
<div>{JSON.stringify(siteConfig, null, 2)}</div> | ||
</DebugLayout> | ||
); | ||
} | ||
|
||
export default DebugMetadata; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
packages/docusaurus-plugin-debug/src/theme/DebugContent/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import DebugLayout from '../DebugLayout'; | ||
|
||
function DebugContent({allContent}) { | ||
return <DebugLayout>{JSON.stringify(allContent, null, 2)}</DebugLayout>; | ||
} | ||
|
||
export default DebugContent; |
7 changes: 7 additions & 0 deletions
7
packages/docusaurus-plugin-debug/src/theme/DebugContent/styles.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
39 changes: 39 additions & 0 deletions
39
packages/docusaurus-plugin-debug/src/theme/DebugLayout/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
import Link from '@docusaurus/Link'; | ||
// import styles from './styles.module.css'; | ||
|
||
const DebugNavLink = ({to, children}) => ( | ||
<Link | ||
style={{margin: 10}} | ||
className="button button--primary" | ||
isNavLink | ||
activeClassName="button--active" | ||
to={to} | ||
exact> | ||
{children} | ||
</Link> | ||
); | ||
|
||
function DebugLayout({children}) { | ||
return ( | ||
<div> | ||
<nav style={{width: '100%', padding: 10, border: 'solid'}}> | ||
<DebugNavLink to="/__docusaurus/debug">Config</DebugNavLink> | ||
<DebugNavLink to="/__docusaurus/debug/metadata">Metadata</DebugNavLink> | ||
<DebugNavLink to="/__docusaurus/debug/registry">Registry</DebugNavLink> | ||
<DebugNavLink to="/__docusaurus/debug/routes">Routes</DebugNavLink> | ||
<DebugNavLink to="/__docusaurus/debug/content">Content</DebugNavLink> | ||
</nav> | ||
<main style={{padding: 20}}>{children}</main> | ||
</div> | ||
); | ||
} | ||
|
||
export default DebugLayout; |
6 changes: 6 additions & 0 deletions
6
packages/docusaurus-plugin-debug/src/theme/DebugLayout/styles.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ |
40 changes: 40 additions & 0 deletions
40
packages/docusaurus-plugin-debug/src/theme/DebugMetadata/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import DebugLayout from '../DebugLayout'; | ||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; | ||
|
||
function DebugMetadata() { | ||
const {siteMetadata} = useDocusaurusContext(); | ||
return ( | ||
<DebugLayout> | ||
<h2>Site Metadata</h2> | ||
<div>Docusaurus Version: {siteMetadata.docusaurusVersion}</div> | ||
<div> | ||
Site Version: {siteMetadata.siteVersion || 'No version specified'} | ||
</div> | ||
<h3>Plugins and themes:</h3> | ||
<ul> | ||
{Object.entries(siteMetadata.pluginVersions).map( | ||
([name, versionInformation]) => ( | ||
<li key={name}> | ||
<div>Name: {name}</div> | ||
<div>Type: {versionInformation.type}</div> | ||
{versionInformation.version && ( | ||
<div>Version: {versionInformation.version}</div> | ||
)} | ||
</li> | ||
), | ||
)} | ||
</ul> | ||
</DebugLayout> | ||
); | ||
} | ||
|
||
export default DebugMetadata; |
7 changes: 7 additions & 0 deletions
7
packages/docusaurus-plugin-debug/src/theme/DebugMetadata/styles.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
30 changes: 30 additions & 0 deletions
30
packages/docusaurus-plugin-debug/src/theme/DebugRegistry/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import DebugLayout from '../DebugLayout'; | ||
import registry from '@generated/registry'; | ||
|
||
function DebugRegistry() { | ||
return ( | ||
<DebugLayout> | ||
{' '} | ||
<h2>Registry</h2> | ||
<ul> | ||
{Object.values(registry).map(([, aliasedPath, resolved]) => ( | ||
<li key={aliasedPath}> | ||
<div>Aliased Path: {aliasedPath}</div> | ||
<div>Resolved Path: {resolved}</div> | ||
</li> | ||
))} | ||
</ul> | ||
</DebugLayout> | ||
); | ||
} | ||
|
||
export default DebugRegistry; |
Oops, something went wrong.