Skip to content

Commit 955bee6

Browse files
committed
chore: resolve conflict
2 parents b2612f4 + b2330d9 commit 955bee6

22 files changed

Lines changed: 396 additions & 136 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ jobs:
6868

6969
- name: Upload coverage to Codecov
7070
if: always()
71-
uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5.5.3
71+
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
7272
with:
7373
files: ./coverage/lcov.info
7474

7575
- name: Upload test results to Codecov
7676
if: always()
77-
uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5.5.3
77+
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
7878
with:
7979
files: ./junit.xml
8080
report_type: test_results

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949

5050
# Initializes the CodeQL tools for scanning.
5151
- name: Initialize CodeQL
52-
uses: github/codeql-action/init@38697555549f1db7851b81482ff19f1fa5c4fedc # v4.34.1
52+
uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
5353
with:
5454
languages: ${{ matrix.language }}
5555
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -59,7 +59,7 @@ jobs:
5959
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
6060
# If this step fails, then you should remove it and run the build manually (see below)
6161
- name: Autobuild
62-
uses: github/codeql-action/autobuild@38697555549f1db7851b81482ff19f1fa5c4fedc # v4.34.1
62+
uses: github/codeql-action/autobuild@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
6363

6464
# ℹ️ Command-line programs to run using the OS shell.
6565
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -72,6 +72,6 @@ jobs:
7272
# ./location_of_script_within_repo/buildscript.sh
7373

7474
- name: Perform CodeQL Analysis
75-
uses: github/codeql-action/analyze@38697555549f1db7851b81482ff19f1fa5c4fedc # v4.34.1
75+
uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
7676
with:
7777
category: '/language:${{matrix.language}}'

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ jobs:
5959

6060
# Upload the results to GitHub's code scanning dashboard.
6161
- name: Upload Scan Results
62-
uses: github/codeql-action/upload-sarif@38697555549f1db7851b81482ff19f1fa5c4fedc # v4.34.1
62+
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
6363
with:
6464
sarif_file: results.sarif

package-lock.json

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

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@node-core/doc-kit",
33
"type": "module",
4-
"version": "1.3.2",
4+
"version": "1.3.3",
55
"repository": {
66
"type": "git",
77
"url": "git+https://github.com/nodejs/doc-kit.git"
@@ -35,7 +35,7 @@
3535
"eslint": "^10.1.0",
3636
"eslint-import-resolver-node": "^0.3.9",
3737
"eslint-plugin-import-x": "^4.16.2",
38-
"eslint-plugin-jsdoc": "^62.8.0",
38+
"eslint-plugin-jsdoc": "^62.8.1",
3939
"eslint-plugin-react-x": "^3.0.0",
4040
"globals": "~17.4.0",
4141
"husky": "^9.1.7",
@@ -51,7 +51,7 @@
5151
"@orama/orama": "^3.1.18",
5252
"@orama/ui": "^1.5.4",
5353
"@rollup/plugin-virtual": "^3.0.2",
54-
"@swc/html-wasm": "^1.15.18",
54+
"@swc/html-wasm": "^1.15.21",
5555
"acorn": "^8.16.0",
5656
"commander": "^14.0.3",
5757
"dedent": "^1.7.2",
@@ -65,7 +65,7 @@
6565
"mdast-util-slice-markdown": "^2.0.1",
6666
"piscina": "^5.1.4",
6767
"preact": "^10.29.0",
68-
"preact-render-to-string": "^6.6.6",
68+
"preact-render-to-string": "^6.6.7",
6969
"reading-time": "^1.5.0",
7070
"recma-jsx": "^1.0.1",
7171
"rehype-raw": "^7.0.0",
@@ -75,7 +75,7 @@
7575
"remark-parse": "^11.0.0",
7676
"remark-rehype": "^11.1.2",
7777
"remark-stringify": "^11.0.0",
78-
"rolldown": "^1.0.0-rc.10",
78+
"rolldown": "^1.0.0-rc.12",
7979
"semver": "^7.7.4",
8080
"shiki": "^4.0.2",
8181
"tinyglobby": "^0.2.15",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'use strict';
2+
3+
// Matches deprecation headings (e.g., "DEP0001: some title") and captures
4+
// the deprecation code (e.g., "DEP0001") as the first group
5+
export const DEPRECATION_HEADING_REGEX = /^(DEP\d+):/;

src/generators/legacy-html/utils/__tests__/slugger.test.mjs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,28 @@ describe('createLegacySlugger', () => {
3636
assert.strictEqual(getLegacySlug('Hello', 'fs'), 'fs_hello_2');
3737
assert.strictEqual(getLegacySlug('World', 'fs'), 'fs_world');
3838
});
39+
40+
describe('deprecation headings', () => {
41+
it('returns the DEP code for a deprecation heading', () => {
42+
const getLegacySlug = createLegacySlugger();
43+
assert.strictEqual(
44+
getLegacySlug(
45+
'DEP0001: `http.OutgoingMessage.prototype.flush`',
46+
'deprecations'
47+
),
48+
'DEP0001'
49+
);
50+
});
51+
52+
it('returns the DEP code regardless of the description text', () => {
53+
const getLegacySlug = createLegacySlugger();
54+
assert.strictEqual(
55+
getLegacySlug(
56+
'DEP0190: spawning .bat and .cmd files with child_process.spawn() with shell option',
57+
'deprecations'
58+
),
59+
'DEP0190'
60+
);
61+
});
62+
});
3963
});

src/generators/legacy-html/utils/slugger.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
'use strict';
22

3+
import { DEPRECATION_HEADING_REGEX } from '../constants.mjs';
4+
35
/**
46
* Creates a stateful slugger for legacy anchor links.
57
*
68
* Generates underscore-separated slugs in the form `{apiStem}_{text}`,
79
* appending `_{n}` for duplicates to preserve historical anchor compatibility.
810
*
11+
* Headings matching the `DEP####:` pattern return just the deprecation code
12+
* (e.g., `DEP0001`) as the anchor, matching the behavior of the old tooling
13+
* and preserving existing external links.
14+
*
915
* @returns {(text: string, apiStem: string) => string}
1016
*/
1117
export const createLegacySlugger =
1218
(counters = {}) =>
1319
(text, apiStem) => {
20+
const depMatch = DEPRECATION_HEADING_REGEX.exec(text);
21+
22+
if (depMatch) {
23+
return depMatch[1];
24+
}
25+
1426
const id = `${apiStem}_${text}`
1527
.toLowerCase()
1628
.replace(/^[^a-z0-9]+|[^a-z0-9]+$/g, '')

src/generators/orama-db/generate.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export async function generate(input) {
3737
description: paragraph
3838
? transformNodeToString(paragraph, true)
3939
: undefined,
40-
href: `${entry.path.slice(1)}.html#${entry.heading.data.slug}`,
40+
href: `${entry.path}.html#${entry.heading.data.slug}`,
4141
siteSection: headings[0].heading.data.name,
4242
};
4343
})

src/generators/web/README.md

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@ The `web` generator transforms JSX AST entries into complete web bundles, produc
66

77
The `web` generator accepts the following configuration options:
88

9-
| Name | Type | Default | Description |
10-
| ---------------- | -------- | --------------------------------------------- | --------------------------------------------------------------------- |
11-
| `output` | `string` | - | The directory where HTML, JavaScript, and CSS files will be written |
12-
| `templatePath` | `string` | `'template.html'` | Path to the HTML template file |
13-
| `project` | `string` | `'Node.js'` | Project name used in page titles and the version selector |
14-
| `title` | `string` | `'{project} v{version} Documentation'` | Title template for HTML pages (supports `{project}`, `{version}`) |
15-
| `editURL` | `string` | `'${GITHUB_EDIT_URL}/doc/api{path}.md'` | URL template for "edit this page" links |
16-
| `pageURL` | `string` | `'{baseURL}/latest-{version}/api{path}.html'` | URL template for documentation page links |
17-
| `imports` | `object` | See below | Object mapping `#theme/` aliases to component paths for customization |
18-
| `virtualImports` | `object` | `{}` | Additional virtual module mappings merged into the build |
9+
| Name | Type | Default | Description |
10+
| ----------------- | --------- | --------------------------------------------- | --------------------------------------------------------------------- |
11+
| `output` | `string` | - | The directory where HTML, JavaScript, and CSS files will be written |
12+
| `templatePath` | `string` | `'template.html'` | Path to the HTML template file |
13+
| `project` | `string` | `'Node.js'` | Project name used in page titles and the version selector |
14+
| `title` | `string` | `'{project} v{version} Documentation'` | Title template for HTML pages (supports `{project}`, `{version}`) |
15+
| `useAbsoluteURLs` | `boolean` | `false` | When `true`, all internal links use absolute URLs based on `baseURL` |
16+
| `editURL` | `string` | `'${GITHUB_EDIT_URL}/doc/api{path}.md'` | URL template for "edit this page" links |
17+
| `pageURL` | `string` | `'{baseURL}/latest-{version}/api{path}.html'` | URL template for documentation page links |
18+
| `imports` | `object` | See below | Object mapping `#theme/` aliases to component paths for customization |
19+
| `virtualImports` | `object` | `{}` | Additional virtual module mappings merged into the build |
1920

2021
#### Default `imports`
2122

@@ -60,6 +61,8 @@ All scalar (non-object) configuration values are automatically exported. The def
6061
| `versions` | `Array<{ url, label, major }>` | Pre-computed version entries with labels and URL templates (only `{path}` remains for per-page use) |
6162
| `editURL` | `string` | Partially populated "edit this page" URL template (only `{path}` remains) |
6263
| `pages` | `Array<[number, { heading, path, category? }]>` | Sorted `[weight, page]` tuples for sidebar navigation (explicit weights first, then default ordering) |
64+
| `useAbsoluteURLs` | `boolean` | Whether internal links use absolute URLs (mirrors config value) |
65+
| `baseURL` | `string` | Base URL for the documentation site (used when `useAbsoluteURLs` is `true`) |
6366
| `languageDisplayNameMap` | `Map<string, string>` | Shiki language alias → display name map for code blocks |
6467

6568
#### Usage in custom components
@@ -99,3 +102,30 @@ The `Layout` component receives the following props:
99102
| `children` | `ComponentChildren` | Processed page content |
100103

101104
Custom Layout components can use any combination of these props alongside `#theme/config` imports.
105+
106+
### HTML template
107+
108+
The HTML template file (set via `templatePath`) uses JavaScript template literal syntax (`${...}` placeholders) and is evaluated at build time with full expression support.
109+
110+
#### Available template variables
111+
112+
| Variable | Type | Description |
113+
| ------------------ | -------- | ----------------------------------------------------------------- |
114+
| `title` | `string` | Fully resolved page title (e.g. `'File system \| Node.js v22.x'`) |
115+
| `dehydrated` | `string` | Server-rendered HTML for the page content |
116+
| `importMap` | `string` | JSON import map for client-side module resolution |
117+
| `entrypoint` | `string` | Client-side entry point filename with cache-bust query |
118+
| `speculationRules` | `string` | Speculation rules JSON for prefetching |
119+
| `root` | `string` | Relative or absolute path to the site root |
120+
| `metadata` | `object` | Full page metadata (frontmatter, path, heading, etc.) |
121+
| `config` | `object` | The resolved web generator configuration |
122+
123+
Since the template supports arbitrary JS expressions, you can use conditionals and method calls:
124+
125+
```html
126+
<title>${title}</title>
127+
<link rel="stylesheet" href="${root}styles.css" />
128+
<script type="importmap">
129+
${importMap}
130+
</script>
131+
```

0 commit comments

Comments
 (0)