Repository navigation
refactor: use Node.js 26 built-ins for locale calendars and the MDX processors cache (AI-assisted) - #12831
refactor: use Node.js 26 built-ins for locale calendars and the MDX processors cache (AI-assisted)#12831slorber wants to merge 1 commit into
Conversation
…rocessors cache (AI-assisted) - Intl.Locale: V8 14.6 removed the non-standard `calendars` getter, use `getCalendars()` - MDX processors cache: use `Map.prototype.getOrInsertComputed()` Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Processor cache creation packages/docusaurus-mdx-loader/src/processor.ts |
createProcessorsCacheEntry now uses ProcessorsCache.getOrInsertComputed for cache lookup and creation. |
Default calendar
| Layer / File(s) | Summary |
|---|---|
Calendar selection packages/docusaurus/src/server/i18n.ts |
getDefaultCalendar returns the first calendar from locale.getCalendars(), or 'gregory' when the returned list is empty. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Refactor
Possibly related PRs
- meta/docusaurus#12821: This PR raises the Node.js runtime floor for the built-in APIs used by both changes.
Merge Risk: 
Minimal · up to 2ad76
-
No actionable compatibility or runtime risk is established for this refactor.
Architecture risk: 
Low · up to 2ad76
-
The change affects 2 systems.
Changed systems:
packages/docusaurus,packages/docusaurus-mdx-loaderArchitecture concerns
No architecture-level concerns identified.Review details
-
Systems and components
- observed — packages/docusaurus (library) was modified; 1 changed file maps to changed impact.
- observed — packages/docusaurus-mdx-loader (library) was modified; 1 changed file maps to changed impact.
Before / after behavior
- observed — Modified behavior in packages/docusaurus-mdx-loader/src/processor.ts:
createProcessorsCacheEntrynow returns the result ofProcessorsCache.getOrInsertComputed, replacing the explicit cache lookup and conditional creation and insertion. - observed — Modified behavior in packages/docusaurus/src/server/i18n.ts:
getDefaultCalendarnow useslocale.getCalendars()directly and returns its first calendar, defaulting to'gregory'when the list is empty. The previous optional-method check and fallback tolocale.calendarsare removed.
-
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
✅ [V2]
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Size Change: 0 B Total Size: 12.1 MB ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 12.1 MB ℹ️ View Unchanged
|
⚡️ Lighthouse report for the deploy preview of this PR
|
Motivation
Use built-ins that Node.js 26 (V8 14.6) brings, now that it's the minimum version:
Intl.Locale.prototype.calendarsgetter (it returnsundefinedon Node 26.13), so our fallback to it was dead code. We now call the standardgetCalendars()directly.Map.prototype.getOrInsertComputed()replaces the manual get-then-set.Not included:
util.debounce()(Node 26.10) could replace_.debounce()in the dev server reload, but the latest@types/node(26.6.6) doesn't type it yet.Test Plan
fa→persian,th→buddhist).pnpm test,pnpm typecheck:testsandpnpm lintpass locally on Node 26.13.0.Test links
Deploy preview: https://deploy-preview-12831--docusaurus-2.netlify.app/
Related issues/PRs
(AI-assisted)
🤖 Generated with Claude Code
Summary by CodeRabbit