Skip to content

Commit 2c51cc9

Browse files
committed
feat: adopt upstream doc-kit fixes for webpack integration
1 parent 348f7d0 commit 2c51cc9

3 files changed

Lines changed: 48 additions & 1 deletion

File tree

doc-kit.config.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
import { resolve, dirname } from 'node:path';
2+
import { fileURLToPath } from 'node:url';
3+
4+
const __dirname = dirname(fileURLToPath(import.meta.url));
5+
16
/**
27
* Configuration for @node-core/doc-kit when generating webpack API docs.
38
*
@@ -18,6 +23,13 @@ export default {
1823
web: {
1924
// Use "webpack" as the product name in navbar and sidebar labels
2025
title: 'webpack',
26+
27+
// Override the default Node.js theming components with webpack-specific ones.
28+
// These aliases are resolved by the bundler during the doc-kit build step.
29+
// @see https://github.com/nodejs/doc-kit/issues/665
30+
imports: {
31+
'#theme/Logo': resolve(__dirname, './ui/WebpackLogo.jsx'),
32+
},
2133
},
2234
'jsx-ast': {
2335
// Disable the "Edit this page" link — webpack API docs are generated from

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"prepare": "husky"
1111
},
1212
"dependencies": {
13-
"@node-core/doc-kit": "^1.2.0",
13+
"@node-core/doc-kit": "^1.2.1",
1414
"semver": "^7.7.4",
1515
"typedoc": "^0.28.18",
1616
"typedoc-plugin-markdown": "^4.11.0",

ui/WebpackLogo.jsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* Webpack logo component for use as the #theme/Logo override.
3+
* Based on the official webpack brand assets.
4+
* @see https://webpack.js.org
5+
*/
6+
const WebpackLogo = props => (
7+
<svg
8+
xmlns="http://www.w3.org/2000/svg"
9+
viewBox="0 0 1200 1200"
10+
width="32"
11+
height="32"
12+
aria-label="webpack"
13+
role="img"
14+
{...props}
15+
>
16+
<path
17+
fill="#fff"
18+
d="M600 60 L1110 340 L1110 860 L600 1140 L90 860 L90 340 Z"
19+
/>
20+
<path
21+
fill="#8ED6FB"
22+
d="M600 143 L1051 400 L1051 800 L600 1057 L149 800 L149 400 Z"
23+
/>
24+
<path
25+
fill="#1C78C0"
26+
d="M600 233 L992 460 L992 740 L600 967 L208 740 L208 460 Z"
27+
/>
28+
<path
29+
fill="#fff"
30+
d="M382 480 L470 480 L530 680 L600 480 L670 480 L740 680 L800 480 L888 480 L780 760 L710 760 L640 560 L560 760 L490 760 Z"
31+
/>
32+
</svg>
33+
);
34+
35+
export default WebpackLogo;

0 commit comments

Comments
 (0)