Skip to content

Commit 9439876

Browse files
authored
feat: numerous bug fixes (#601)
1 parent 264ce66 commit 9439876

File tree

7 files changed

+78
-34
lines changed

7 files changed

+78
-34
lines changed

npm-shrinkwrap.json

Lines changed: 22 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"@reporters/github": "^1.12.0",
2929
"@types/mdast": "^4.0.4",
3030
"@types/node": "^24.10.1",
31+
"@types/semver": "^7.7.1",
3132
"c8": "^10.1.3",
3233
"eslint": "^9.39.2",
3334
"eslint-import-resolver-node": "^0.3.9",
@@ -42,7 +43,7 @@
4243
"@actions/core": "^3.0.0",
4344
"@heroicons/react": "^2.2.0",
4445
"@node-core/rehype-shiki": "1.3.0",
45-
"@node-core/ui-components": "^1.5.10",
46+
"@node-core/ui-components": "^1.6.0",
4647
"@orama/orama": "^3.1.18",
4748
"@orama/ui": "^1.5.4",
4849
"@rollup/plugin-virtual": "^3.0.2",

src/generators/jsx-ast/utils/buildBarProps.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const extractHeading = entry => {
6868
value: heading,
6969
stability: parseInt(entry.stability?.children[0]?.data.index ?? 2),
7070
slug: data.slug,
71-
data: { id: data.slug },
71+
data: { id: data.slug, type: data.type },
7272
};
7373
};
7474

src/generators/jsx-ast/utils/buildContent.mjs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,15 @@ export const createHeadingElement = (content, changeElement) => {
119119

120120
// Build heading with anchor link
121121
const headingWrapper = createElement('div', [
122-
createElement(`h${depth}`, [
123-
createElement(`a#${slug}`, { href: `#${slug}` }, headingContent),
124-
]),
122+
createElement(
123+
`h${depth}`,
124+
{ id: slug },
125+
createElement(
126+
'a',
127+
{ href: `#${slug}`, className: ['anchor'] },
128+
headingContent
129+
)
130+
),
125131
]);
126132

127133
// Prepend type icon if not 'misc' and type exists

src/generators/types.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { SemVer } from 'semver';
2-
import type { ApiDocReleaseEntry } from '../types';
32
import type { publicGenerators, allGenerators } from './index.mjs';
43

54
declare global {

src/generators/web/ui/components/MetaBar/index.jsx

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,38 @@ const iconMap = {
2121

2222
const STABILITY_KINDS = ['error', 'warning', null, 'info'];
2323
const STABILITY_LABELS = ['D', 'E', null, 'L'];
24+
const STABILITY_TOOLTIPS = ['Deprecated', 'Experimental', null, 'Legacy'];
25+
26+
/**
27+
* Renders a heading value with an optional stability badge
28+
* @param {{ value: string, stability: number }} props
29+
*/
30+
const HeadingValue = ({ value, stability }) => {
31+
if (stability === 2) {
32+
return value;
33+
}
34+
35+
const ariaLabel = STABILITY_TOOLTIPS[stability]
36+
? `Stability: ${STABILITY_TOOLTIPS[stability]}`
37+
: undefined;
38+
39+
return (
40+
<>
41+
{value}
42+
43+
<Badge
44+
size="small"
45+
className={styles.badge}
46+
kind={STABILITY_KINDS[stability]}
47+
data-tooltip={STABILITY_TOOLTIPS[stability]}
48+
aria-label={ariaLabel}
49+
tabIndex={0}
50+
>
51+
{STABILITY_LABELS[stability]}
52+
</Badge>
53+
</>
54+
);
55+
};
2456

2557
/**
2658
* MetaBar component that displays table of contents and page metadata
@@ -38,21 +70,7 @@ export default ({
3870
headings={{
3971
items: headings.map(({ value, stability, ...heading }) => ({
4072
...heading,
41-
value:
42-
stability !== 2 ? (
43-
<>
44-
{value}
45-
<Badge
46-
size="small"
47-
className={styles.badge}
48-
kind={STABILITY_KINDS[stability]}
49-
>
50-
{STABILITY_LABELS[stability]}
51-
</Badge>
52-
</>
53-
) : (
54-
value
55-
),
73+
value: <HeadingValue value={value} stability={stability} />,
5674
})),
5775
}}
5876
items={{
@@ -62,10 +80,12 @@ export default ({
6280
<ol>
6381
{viewAs.map(([title, path]) => {
6482
const Icon = iconMap[title];
83+
6584
return (
6685
<li key={title}>
6786
<a href={path}>
6887
{Icon && <Icon className={styles.icon} />}
88+
6989
{title}
7090
</a>
7191
</li>
@@ -76,6 +96,7 @@ export default ({
7696
Contribute: (
7797
<>
7898
<GitHubIcon className="fill-neutral-700 dark:fill-neutral-100" />
99+
79100
<a href={editThisPage}>Edit this page</a>
80101
</>
81102
),

src/generators/web/utils/bundle.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ export default async function bundleCode(codeMap, { server = false } = {}) {
3131
chunkImportMap: !server,
3232
},
3333

34+
checks: {
35+
// Disable plugin timing logs for cleaner output. This can be re-enabled for debugging performance issues.
36+
pluginTimings: false,
37+
},
38+
3439
// Output configuration
3540
output: {
3641
// Output module format:
@@ -79,6 +84,9 @@ export default async function bundleCode(codeMap, { server = false } = {}) {
7984

8085
// Module resolution configuration.
8186
resolve: {
87+
// exports condition to use
88+
conditionNames: ['rolldown'],
89+
8290
// Alias react imports to preact/compat for smaller bundle sizes.
8391
// Explicit jsx-runtime aliases are required for the automatic JSX transform.
8492
alias: {

0 commit comments

Comments
 (0)