Skip to content

feat: minimal vite-devtools-style hubs mounting every built-in plugin#46

Merged
antfu merged 10 commits into
devframes:mainfrom
antfubot:shy-walls-walk
Jun 25, 2026
Merged

feat: minimal vite-devtools-style hubs mounting every built-in plugin#46
antfu merged 10 commits into
devframes:mainfrom
antfubot:shy-walls-walk

Conversation

@antfubot

@antfubot antfubot commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Turns both minimal hub examples into the smallest copyable vite-devtools-style hub: an icon dock of every built-in plugin, an iframe stage, and a drawer of hub subsystems, all skinned with the shared @internal/design system. vite-devtools is the full Vite viewer built on @devframes/hub; these examples are the reference for building your own viewer on the same protocol. Dogfooding the plugins end to end surfaced a few gaps in devframe itself, fixed here.

Examples

  • Both hubs (Vite + Next) mount all five built-in plugins — git, terminals, code-server, inspect, a11y — each a DevframeDefinition registered with mountDevframe. Verified in a browser: git shows live data, terminals runs an interactive PTY, code-server launches an authenticated editor, the inspector lists every plugin's RPC functions, and the a11y panel renders.
  • Both are styled with @internal/design: presetDevframe() + theme.css carry the token theme, the df-* component vocabulary (df-navtab, df-panel, df-dot, df-btn), and Phosphor preset-icons. Dock glyphs resolve to i-ph-* classes inlined offline — no icon-set bundle, no runtime network. The Vite hub loads UnoCSS via unocss/vite; the Next hub via @unocss/postcss (mirroring the git plugin).
  • The Next host loads the plugins through a bundler-ignored dynamic import() and sets skipTrailingSlashRedirect, so their node-side code and relative SPA assets work under Turbopack.

devframe / hub

  • mountDevframe now serves each mounted devframe's connection meta at its base via a new optional DevframeHost.mountConnectionMeta hook, so an embedded SPA discovers the RPC endpoint directly instead of relying on same-origin parent-window inheritance (which breaks for cross-origin / sandboxed iframes).

Plugins

  • plugin-terminals mirrors its sessions into the hub's terminals subsystem when hubbed, so a hub UI lists them; standalone runtimes are unaffected.
  • plugin-code-server reads the version from the first semver token, so cold-start i18n output no longer leaks into the launcher's version label.

Build / docs

  • turbo.json: the example build tasks now depend on the plugin builds they import, so a fresh turbo run build can't race a plugin's dist.
  • Adds a "bundled hosts (Next.js)" recipe to the hub guide and frames both examples as minimal vite-devtools references.

Validated with typecheck, lint, the full test suite (503 passing), and build.

🤖 This PR was created with the help of an agent.

antfubot added 4 commits June 24, 2026 07:40
A mounted devframe's SPA loads in an iframe at its base and discovers the RPC endpoint by fetching a relative ./__connection.json. Hubs only served their own meta, so embedded SPAs could connect only by inheriting it from a same-origin parent window — failing for cross-origin or sandboxed iframes.

mountDevframe now asks the host to serve that meta at each devframe's base through a new optional DevframeHost.mountConnectionMeta hook, so embedded SPAs discover the endpoint directly.
When mounted in a hub, the plugin managed its own sessions while the hub's terminals subsystem stayed empty. The manager now mirrors its live sessions into ctx.terminals when that context is present, so a hub UI lists them alongside other tools. Standalone runtimes have no such context and are unaffected.
A cold-start `code-server --version` can print i18n initialization output before the version line, which leaked into the reported version. Match the first semver-looking token instead of the leading whitespace token.
Mount @devframes/plugin-git, -terminals, and -code-server in both the Vite and Next minimal hub examples so they exercise real RPC, streaming, and child-process integrations end to end.

Both hosts now serve per-devframe connection meta. The Next host loads the plugins through a bundler-ignored dynamic import and skips trailing-slash redirects so the published SPAs resolve their assets and connect. Adds a bundled-host recipe to the hub guide and the missing plugin-git source alias.
@netlify

netlify Bot commented Jun 24, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit 5a98617
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a3cb4a02be2700008910fec
😎 Deploy Preview https://deploy-preview-46--devfra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

antfubot added 3 commits June 25, 2026 01:50
The minimal hub examples now import the built-in plugin packages, so their build must wait for those packages' dist. Add the plugin build tasks to each example's dependsOn — otherwise the example's config load races a plugin's dist rewrite and fails to resolve its entry.
Mount all five built-in plugins (git, terminals, code-server, inspect, a11y) in both the Vite and Next minimal hubs, and reshape their UI into a minimal vite-devtools-style icon dock: each tool shows its Phosphor icon (inlined offline), the selected one fills the stage, and the hub subsystems sit in a bottom drawer.

Frames both examples as the smallest copyable vite-devtools — a reference for building a viewer on @devframes/hub. The a11y plugin loads from its TypeScript entry; inspect mounts like the other published plugins.
@antfubot antfubot changed the title feat: dogfood built-in plugins in the minimal vite & next hubs feat: minimal vite-devtools-style hubs mounting every built-in plugin Jun 25, 2026
antfubot added 3 commits June 25, 2026 03:58
Replace the inline-SVG icon map with UnoCSS preset-icons (the vite-devtools approach): icons resolve to i-ph-* classes inlined offline from @iconify-json/ph. Restyle the shell with semantic light/dark shortcuts.
Replace the examples' hand-rolled UnoCSS with @internal/design's presetDevframe + theme.css — the same preset, token theme, df-* component vocabulary, and Phosphor preset-icons the built-in plugins use. The Vite hub loads it via unocss/vite; the Next hub via @unocss/postcss (mirroring the git plugin). Dock glyphs resolve to i-ph-* classes inlined offline, no SVG map.
@antfu antfu merged commit a262259 into devframes:main Jun 25, 2026
12 checks passed
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