Skip to content

chore: more customizing#817

Merged
avivkeller merged 2 commits into
mainfrom
custom
Jun 3, 2026
Merged

chore: more customizing#817
avivkeller merged 2 commits into
mainfrom
custom

Conversation

@avivkeller
Copy link
Copy Markdown
Member

Adds more customizability into the web generator, with custom templating and lightningcss options

@avivkeller avivkeller requested a review from a team as a code owner June 1, 2026 16:58
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-docs-tooling Ready Ready Preview Jun 3, 2026 3:33pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented Jun 1, 2026

PR Summary

Low Risk
Build-time documentation generator customization only; no auth, data, or runtime API changes beyond optional raw head.html content supplied by config authors.

Overview
The web generator gains two customization hooks and a small 1.3.7 release bump.

Configurable document <head> — Project-specific <meta>, <link>, and optional raw HTML move out of hardcoded template.html into a head config (meta / links as attribute arrays, html for escape-hatch markup). A new buildHead helper renders those tags once per build and injects them via a ${head} template placeholder; Node.js defaults live in generator defaults instead of the template. Structural tags (og:title, og:type, Google Fonts) stay in the template.

LightningCSS passthroughweb.lightningcss options are spread into every CSS bundleAsync call (e.g. visitor, customAtRules), with types and README docs. head and lightningcss are excluded from #theme/config so they are not serialized to client bundles.

Tests cover buildHead behavior and end-to-end HTML output for a custom head override.

Reviewed by Cursor Bugbot for commit d5720c8. Bugbot is set up for automated code reviews on this repo. Configure here.

const renderTag = (tag, attrs) => {
const rendered = Object.entries(attrs)
.filter(([, value]) => value != null && value !== false)
.map(([key, value]) => (value === true ? ` ${key}` : ` ${key}="${value}"`))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Attribute values not HTML-escaped in renderTag

Medium Severity

renderTag interpolates attribute values directly into double-quoted HTML attributes without escaping special characters. A content value containing a double quote (e.g. a project description like The "best" toolkit) produces malformed HTML (content="The "best" toolkit"), breaking the tag and potentially causing the downstream HTML minifier to error or emit garbled output. Ampersands in URLs with query parameters (?a=1&b=2) are also technically invalid. Values need at least "&quot; and &&amp; encoding.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 55c78ba. Configure here.

@avivkeller
Copy link
Copy Markdown
Member Author

cc @nodejs/web-infra

Copy link
Copy Markdown
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

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

LGMT !

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.33%. Comparing base (bf76f97) to head (d5720c8).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #817      +/-   ##
==========================================
+ Coverage   82.86%   84.33%   +1.46%     
==========================================
  Files         171      172       +1     
  Lines       14961    15420     +459     
  Branches     1313     1363      +50     
==========================================
+ Hits        12398    13005     +607     
+ Misses       2554     2406     -148     
  Partials        9        9              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c87e6f2. Configure here.

// User-supplied LightningCSS options (e.g. `visitor`, `customAtRules`),
// spread into every bundle call below.
const { lightningcss = {} } = getConfig('web');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CSS cache ignores lightningcss

Medium Severity

The Rolldown CSS plugin caches compiled output in a module-level fileCache keyed only by file path. After lightningcss options are applied in bundleAsync, a later generate in the same Node process can return CSS from an earlier run, so changes to visitor, targets, or other options have no effect until the process restarts.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c87e6f2. Configure here.

@avivkeller avivkeller enabled auto-merge (squash) June 3, 2026 15:31
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

orama-db Generator

File Base Head Diff
orama-db.json 8.84 MB 8.84 MB -1.00 B (-0.00%)

web Generator

File Base Head Diff
all.js 20.17 MB 20.17 MB -140.00 B (-0.00%)
all.html 19.74 MB 19.74 MB -98.00 B (-0.00%)

@avivkeller avivkeller disabled auto-merge June 3, 2026 15:34
@avivkeller avivkeller merged commit 02509b2 into main Jun 3, 2026
23 checks passed
@avivkeller avivkeller deleted the custom branch June 3, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants