import fs from 'node:fs'; import path from 'node:path'; import { parseFragment, type DefaultTreeAdapterTypes } from 'parse5'; import { parseAst, type Plugin } from 'vite'; import { sampleScopeClass } from './sample-discovery'; import { scopeStylesheet } from './sample-stylesheets'; /** * A plain-HTML example (`/.vanilla.html`) as the demo build (vite.demos.config.ts) * mounts it. The page is what a reader copies: some markup, and module scripts that load the * viewer from its CDN script and talk to the elements. In a demo, which mounts into the docs page * itself, the page becomes a module exporting `mount(el)`, like every framework's: * * - The markup goes into `el` each time the demo mounts. A `