Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions components/Layout/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import TableOfContents from '@node-core/ui-components/Common/TableOfContents';
import Article from '@node-core/ui-components/Containers/Article';
import { Analytics } from '@vercel/analytics/react';
import { SpeedInsights } from '@vercel/speed-insights/react';

import NavBar from '../Navigation';
import MetaBar from '../Metabar';
import SideBar from '../Sidebar';
Comment on lines +6 to +8
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The relative imports ../Navigation, ../Metabar, and ../Sidebar rely on directory-style resolution. Native Node ESM does not support directory imports (it won’t resolve to index.jsx), which can break doc-kit generate if it loads this file via Node’s resolver. Prefer importing the explicit file paths (e.g., ../Navigation/index.jsx, etc.) to ensure resolution is reliable across tooling.

Suggested change
import NavBar from '../Navigation';
import MetaBar from '../Metabar';
import SideBar from '../Sidebar';
import NavBar from '../Navigation/index.jsx';
import MetaBar from '../Metabar/index.jsx';
import SideBar from '../Sidebar/index.jsx';

Copilot uses AI. Check for mistakes.

import Footer from '#theme/Footer';

/**
* @typedef {Object} Props
* @property {import('@node-core/doc-kit/src/generators/web/ui/types.d.ts').SerializedMetadata} metadata
* @property {Array} headings
* @property {string} readingTime
* @property {import('preact').ComponentChildren} children
*/

/**
* @param {Props} props
*/
export default ({ metadata, headings, readingTime, children }) => (
<>
<Analytics />
<SpeedInsights />
<NavBar />
<Article>
<SideBar metadata={metadata} />
<div>
<div>
<TableOfContents headings={headings} summaryTitle="On this page" />
<br />
<main>{children}</main>
</div>
<MetaBar
metadata={metadata}
headings={headings}
readingTime={readingTime}
/>
</div>
</Article>
<Footer />
</>
);
13 changes: 1 addition & 12 deletions doc-kit.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,7 @@ export default {
editURL: 'https://github.com/nodejs/learn/edit/main/pages{path}.md',
imports: {
...web.defaultConfiguration.imports,
'#theme/Navigation': join(
import.meta.dirname,
'components/Navigation/index.jsx'
),
'#theme/Sidebar': join(
import.meta.dirname,
'components/Sidebar/index.jsx'
),
'#theme/Metabar': join(
import.meta.dirname,
'components/Metabar/index.jsx'
),
'#theme/Layout': join(import.meta.dirname, 'components/Layout/index.jsx'),
},
},
};
84 changes: 83 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
"typescript-eslint": "^8.57.2"
},
"dependencies": {
"@node-core/ui-components": "^1.6.3"
"@node-core/ui-components": "^1.6.3",
"@vercel/analytics": "^2.0.1",
"@vercel/speed-insights": "^2.0.0"
},
"engines": {
"node": "24.x"
Expand Down
Loading