Repository navigation
[docs-infra] Render one experiment demo through docs-infra - #48961
Draft
brijeshb42 wants to merge 13 commits into
Draft
brijeshb42 wants to merge 13 commits into
brijeshb42 wants to merge 13 commits into
Conversation
Adds @mui/internal-docs-infra to the docs package with a version policy. Demo rendering is unchanged.
Deploy previewBundle size
Check out the code infra dashboard for more information about this PR. |
Adds a per-demo pipeline resolver and an adapter component that owns future docs-infra imports. The allowlist is empty, so every demo keeps rendering through the legacy pipeline.
Moves the allowlist and resolver into @mui/internal-markdown so the build and the runtime read one source of truth without a package cycle.
The Markdown loader branches per marker and precomputes the docs-infra source graph for allowlisted demos only. The selected experiment demo now displays the source docs-infra loaded, still highlighted by Prism, so the page is unchanged.
brijeshb42
force-pushed
the
di-migration-bootstrap
branch
2 times, most recently
from
August 14, 2026 07:14
7ba05a9 to
9bf420a
Compare
The loader emits the docs-infra highlighted markup, HighlightedCode accepts pre-highlighted HTML, and the adapter maps the Starry Night scope classes to the existing okaidia palette. Legacy demos are unaffected.
Replaces the page-and-demo allowlist with a "docsInfra": true marker option. The loader collects opted-in demos while scanning markers and the runtime reads the same marker, so the opt-in lives at the call site and marker edits invalidate the loader cache. The capability set stays in code behind a master switch.
The capability set is the single control: the loader precomputes only when source loading is enabled, and turning every capability off returns migrated demos to the legacy rendering.
Replaces the local tarball in docs and @mui/internal-markdown with the pkg.pr.new canary from mui/mui-public#1773.
getHastTextContent and toHtml take HAST nodes, but VariantSource also covers strings and the serialized forms. Checks the shape at runtime instead of assuming the requested output.
Demos keep JSX in their .js files, which the plain JavaScript grammar leaves unclassified. Passes the jsx language to docs-infra and colours JSX element names like the legacy pipeline does.
brijeshb42
force-pushed
the
di-migration-bootstrap
branch
from
August 14, 2026 07:30
9bf420a to
b7044bc
Compare
silviuaavram
requested changes
Aug 18, 2026
silviuaavram
left a comment
Member
There was a problem hiding this comment.
did a first pass. investigated some issues raised by codex.
| <DemoCodeViewer | ||
| key={index} | ||
| code={tab.raw} | ||
| highlightedHtml={index === 0 ? demo.highlightedHtml : undefined} |
Member
There was a problem hiding this comment.
In http://localhost:3000/experiments/docs/docs-infra/#docs-infra-transform I've added some typescript related stuff to the demo code, and it shows only the js code, regardless of the active js/ts tab. the copy code button works fine.
| this.addDependency(fileURLToPath(dependency)); | ||
| }); | ||
|
|
||
| demos[demoName].docsInfra = docsInfra; |
Member
There was a problem hiding this comment.
raised by codex, apparently we are sending more data than we should. we only need source and html. so we can string everything else like externals and dependencies. feel free to double check.
brijeshb42
marked this pull request as draft
August 18, 2026 08:42
This branch has not been deployed
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.
Adds
@mui/internal-docs-infrato the docs and puts one experiment demo on it. Everything else stays on the current pipeline.A demo opts in from its marker:
{{"demo": "DemoInDocsDocsInfra.js", "docsInfra": true, "defaultCodeOpen": true, "disableLiveEdit": true}}The loader precomputes the source graph only for those demos, and
RichMarkdownElementrendersDocsInfraDemoinstead ofDemocomponent. /experiments/docs/docs-infra has both kinds on one page.Markdown decides which demos migrate;
docsInfraDemoFlagsdecides what that means, currently source loading and highlighting and nothing else. The demo still renders the same bundled component, keeps its toolbar, and its JS/TS toggle still reads the sibling files. Nothing from docs-infra reaches the browser — it's build-time only.So can be merged into master without worrying about affecting end-user.