Skip to content

feat!: remove per-plugin vite wrappers; export hub base constants from @devframes/hub/constants - #238

Open
antfubot wants to merge 1 commit into
mainfrom
plan-040-mirror-fringe
Open

feat!: remove per-plugin vite wrappers; export hub base constants from @devframes/hub/constants#238
antfubot wants to merge 1 commit into
mainfrom
plan-040-mirror-fringe

Conversation

@antfubot

Copy link
Copy Markdown
Collaborator

Intent

Deletes three drift-prone hand-copy clusters described in plan 040 ("delete the mirror fringe"). Each was a shallow module — a rename, a hand-copied constant, or a re-implemented helper — with a single canonical home elsewhere in the codebase. This is an intentional breaking change during the 0.9 beta window; there is no deprecation cycle.

A. Six per-plugin vite.ts wrappers deleted

plugins/{a11y,assets,data-inspector,inspect,messages,og}/src/vite.ts were each an 8–25 line rename over devframeVite(def, options) from @devframes/vite/dev-spa, and the sole reason those six plugins depended on @devframes/vite. Deleted, along with their /vite export subpath, tsdown.config.ts entry, and the now-stale @devframes/vite dependencies entry (moved to devDependencies, since each plugin's own src/spa/vite.config.ts still uses devframeVite directly to dogfood the plugin during pnpm dev/build). Every doc, README, and internal vite.config.ts that imported the wrapper now calls devframeVite(pluginDevframe, options) directly.

plugin-code-server's codeServerVite and plugin-terminals's terminalsVite are intentionally left alone (a STOP condition in the plan) — inventory found they aren't pure delegation: each composes devframeViteBridge + devframeVitePlugin together (two plugins where the other six use exactly one) and builds its devframe from the passed options via createCodeServerDevframe/createTerminalsDevframe, rather than importing a static default export. That's real behavior, not a mirror.

B. DEVFRAMES_HUB_BASE hand-copied ×4

Previously defined in packages/hub/src/node/initiate.ts and hand-copied (each commented "mirrors @devframes/hub's") into packages/vite/src/hub-client.ts, packages/nuxt/src/hub.ts, packages/nuxt/src/hub-client.ts, and packages/next/src/hub-client.tsx. Now defined once in the client-safe packages/hub/src/constants.ts (already a published @devframes/hub/constants subpath, and confirmed to stay client-safe — it only adds a plain string constant and a pure string-manipulation helper backed by ufo, a package hub already depends on). node/initiate.ts re-exports it for existing importers of that entry (no user-facing break there).

C. normalizeBase reimplemented ×4

Two different mechanisms were in play (ufo in hub/node/initiate.ts and next/src/hub.ts; hand-rolled string concatenation in vite/src/hub.ts and nuxt/src/hub.ts). Consolidated into one normalizeHubBase (ufo-based, since @devframes/hub already depends on ufo) exported next to the constant, and every call site — @devframes/hub itself plus all three framework adapters — now imports it instead of keeping a local copy.

Also deleted packages/hub-ui/src/client/state/renderers.ts, a 30-line shim that only delegated to createDockRenderersContext; its one call site (state/context.ts) now calls that directly.

Breaking change

The six plugins' /vite export subpath (a11yVitePlugin, assetsVitePlugin, dataInspectorVitePlugin, inspectVitePlugin, messagesVitePlugin, ogVitePlugin) is gone. Migration documented in docs/guide/migration-0.9.md (new "Built-in plugins' /vite subpath is removed" section + overview table row).

Verification

  • pnpm lint && pnpm knip && pnpm test && pnpm typecheck && pnpm build — all green. The four @devframes/hub API snapshots that changed (constants/initiate, runtime + dts) were regenerated deliberately with TSNAPI_ALLOW_BREAKING=1 (the narrowed DEVFRAMES_HUB_BASE re-export is the intended, non-breaking-in-practice shape — same value, now sourced from one place). The six deleted plugins' stale /vite API snapshots were removed.
  • Ran examples/hub-vite end-to-end (pnpm dev, which exercises viteDevframeHub@devframes/hub's initHub → the new normalizeHubBase/DEVFRAMES_HUB_BASE): every built-in plugin dock — including code-server and terminals, whose wrappers were kept — mounted and served 200 at /__devframes/<id>/, and /__devframes/__index.json listed all frames correctly.

Impact

61 files changed, +143/−365 lines. Kills four drift-prone hand-copies and drops @devframes/vite from six plugins' runtime dependency graph.


Created with the help of an agent.

…m @devframes/hub/constants

Deletes three drift-prone hand-copy clusters:

- plugins/{a11y,assets,data-inspector,inspect,messages,og}/src/vite.ts
  — each an 8-25 line rename over devframeVite(def, options) from
  @devframes/vite/dev-spa, and the sole reason those plugins depended
  on @devframes/vite. Consumers now call devframeVite() directly
  against the plugin's default export; @devframes/vite moves to
  devDependencies where it's still needed for the plugin's own SPA
  dev config. plugin-code-server's codeServerVite and
  plugin-terminals's terminalsVite are unaffected — they compose a
  bridge + static plugin and build their devframe from options, which
  is real behaviour beyond delegation, not a mirror.

- DEVFRAMES_HUB_BASE hand-copied across packages/{vite,nuxt,next}'s
  hub-client wrappers (each commented "mirrors @devframes/hub's").
  Now defined once in the client-safe packages/hub/src/constants.ts
  and imported everywhere; packages/hub/src/node/initiate.ts
  re-exports it for existing importers of that entry.

- normalizeBase reimplemented ×4 with two different mechanisms (ufo
  vs hand-rolled). One canonical normalizeHubBase (ufo-based, hub
  already depends on ufo) now lives next to the constant and is used
  by @devframes/hub itself and all three framework adapters.

Also deletes packages/hub-ui/src/client/state/renderers.ts, a
30-line shim that only delegated to createDockRenderersContext; its
one call site now calls that directly.

Breaking: the six plugins' /vite export subpath is gone. Migration
documented in docs/guide/migration-0.9.md.

Created with the help of an agent.
@netlify

netlify Bot commented Aug 15, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit d28900a
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a80521369d6af00084b7aa2
😎 Deploy Preview https://deploy-preview-238--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.

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.

1 participant