Repository navigation
feat: compile generated MDX documents as templates - #2071
Merged
domgan-oai merged 5 commits intoOct 14, 2026
Merged
Conversation
domgan-oai
marked this pull request as ready for review
October 14, 2026 23:12
Contributor
Benchmark report
Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)
9 other measured values are unchanged. Public-import reachability bundles (bytes)
51 other measured values are unchanged. |
1 task done
11 of 12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Compile both generated MDX document functions as Octane templates. Add
strongandoverridableTagsoptions, and pass the website's shared Strong policy with onlytable/preoverridable. Provider, document-prop, named-component and layout precedence remain intact; omitting the tag list retains full host override support.The real website comparison exposed an existing runtime defect: client navigation mounted native table sections through
DocTable, and the fragment parser discarded their rows. Parse the roots in template context before adding an inert wrapper, preserving custom-element construction/connection order. Include owning runtime and MDX regressions plus website navigation/HMR coverage.Part of #2059; this does not close the wider migration issue.
Validation
pnpm format:check— scopedpnpm format:files:checkused.pnpm typecheck— focused MDX/Docusaurus public and package types, changed-file types, runtime and website types used.pnpm test— focused suites below; full matrix runs in CI.479118fb2: development/production × default/restricted tags, SSR adoption, mapping precedence, retained counter state, removal and unmount. All 12 screenshot pairs are byte-identical.perf-review: no mechanical candidates or unresolved independent-review findings. The owning production mount benchmark and all six applicable ratio guards pass, preserving per-row/update/reorder work; one additional append occurs only when first parsing a fragment. Chromium checks preserve custom-element order, foreign-document adoption and hydration identity. The CI paired benchmark records all 64 work counters unchanged and all 20 timing comparisons within its ±3% noise criterion. Representative complete core apps grow by 5–44 B gzip (TSRX starter +10 B, JSX starter +30 B, full framework +14 B); this small parser-fix cost is included in the net website saving below. No latency claim.concise-code: authored source +228/−130 lines (runtime +12/−10). Reuses MDX's printer/source-map extension and core template HMR; removes the bespoke MDX HMR shim. No new parser, dependency, runtime flag, or per-render state. Two changeset files cover the public options and parser fix. A parallel legacy descriptor pipeline and website table workaround were rejected.c3719be8d: requiredlint,typecheck,test (24); all four parity shards; 54,057 sharded tests passed (two skipped), 616 Chromium tests, and all 105 website tests including live MDX HMR. Publication validates 123 tarballs and strict TypeScript 5.9/6/7.1 consumer lanes. Bugbot reports no issues; no unresolved review comments.Matched production builds (
2d2bac446→c3719be8d), same dependency versions and configuration:Every emitted
.js/.mjs/.cjsunder the public output is included, including copied runtimes; gzip level 9 is summed per file. Server output, maps and non-JS assets are excluded. The four binary Lynx containers are recorded separately: raw unchanged, gzip +4 bytes. No runtime-speed claim.Risk / follow-ups
callDestroyLifetimeFunconsole errors and twoundefinedpage errors per viewport. This comparison is behavior-equivalent, not error-free; no unrelated workaround was added. The candidate has zero failed requests; main cancelled 15 native-gallery PNG requests while navigating away, with zero in its narrow run. Those navigation cancellations are recorded separately from the passing content/control assertions.2d2bac446. MDX/Docusaurus tests and types, runtime/website types, sync, formatting and the production website comparison were rerun after integration. Independent input comparison confirms the earlier provider/HMR, core-regression and DOM-work evidence is unaffected by release metadata and the version export; earlier HMR screenshots retain the old version badge. Complete MDX fixture bundles were rebuilt and retain their measured reductions.Provenance
agent-authored)Codex task · implementation host
com-79386.Need help on this PR? Tag
@codesmith-botwith what you need.Note
Medium Risk
Changes the MDX compile output shape and template DOM parsing used for hydration and table wrappers; broad test coverage but affects default content rendering and dev HMR behavior.
Overview
Generated MDX document functions (
_createMdxContentandMDXContent) now compile as Octane templates on client and server via a rewrittenrecmaOctaneAdapterthat uses MDX’s printer extension (OctaneTemplateBody) instead of treating the body as ordinary JSX. Document HMR moves to core template HMR (the bespoke MDXhmr()shim is removed), with Strong diagnostics and optionaloverridableTagsforwarded throughcompileMdx/octaneMdxso sites can fix most markdown hosts as static templates while still overriding listed tags (default: all hosts overridable).Octane runtime fixes multi-root template parsing: HTML is parsed in template context before wrapping in
octane-frag, sothead/tbody/ rows survive when table sections are passed as children through a component wrapper (e.g. doc sitetableoverrides).Docs, binding status, and tests cover mapping precedence, Shiki/hydration, source maps, Vite option forwarding, website
table/pre+ Strong, and MDX hot reload without remounting sibling UI.Reviewed by Cursor Bugbot for commit c3719be. Bugbot is set up for automated code reviews on this repo. Configure here.