Skip to content

feat(plugin-inspect): serve the SPA from a lockstep assets package - #239

Merged
antfu merged 3 commits into
mainfrom
feat/plugin-inspect-client
Aug 16, 2026
Merged

feat(plugin-inspect): serve the SPA from a lockstep assets package#239
antfu merged 3 commits into
mainfrom
feat/plugin-inspect-client

Conversation

@antfubot

@antfubot antfubot commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #236

Base branch is feat/remote-client-assets (the remote-assets engine), not main — review/merge #236 first. This PR is the wave-1 pilot that proves the deferred-assets pattern end to end on one plugin.

What

The inspector's Vue SPA moves out of the @devframes/plugin-inspect node tarball into a new lockstep-versioned @devframes/plugin-inspect--assets package:

  • The plugin tarball drops from ~409 KB (90% SPA) → ~18 KB (node code + the small panel dist/client).
  • cli.distDir now points at a RemoteAssets declaration — { package: '@devframes/plugin-inspect--assets', version: pkg.version, resolveFrom: import.meta.url }.
  • The SPA's Vite build emits into plugins/inspect/assets-pkg/dist; the assets package ships just that dist to npm.

Naming: ${pkg.name}--assets

Two decisions:

  • assets, not client — 'client' is overloaded in devframe (devframe/client is the RPC client connectDevframe; each plugin's ./client export is its panel script). A package of prebuilt browser assets is …--assets.
  • Double dash separates the auto-derived companion suffix from the plugin's own dash-delimited name segments, so it stays visually distinct.

Directory convention: plugins/*/assets-pkg.

Resolution (unchanged engine from #236)

  1. Local install — in this monorepo the assets package is a dev-only workspace:* link, so resolveFrom short-circuits to its built dist with zero network. Air-gapped users get the same by npm install-ing it.
  2. Cache → 3. CDN back-proxy (jsDelivr) at @devframes/plugin-inspect--assets@<version>/dist/… for everyone else, on demand.

Wiring

  • pnpm-workspace.yaml: new plugins/*/assets-pkg glob.
  • turbo.json: the plugin build declares assets-pkg/dist/** as an output (verified cache-hit restores it).
  • The assets package is a dev-only workspace link on the plugin (never a runtime dependency), so published consumers don't auto-install it — it stays deferred.
  • knip.jsonc: override for the runtime-string dependency + the assets-only package.
  • Plugin test harness resolves distDir via resolveStaticAssetsSource (monorepo link → local dir).
  • Lockstep versioning is automatic via bumpp -r.

Verification

typecheck 30/30 · unit tests 1162 pass (1 skipped: tsnapi no-exports for the assets-only pkg) · lint clean · knip clean · full build green · turbo cache restores the nested dist.

Follow-ups (rest of wave 1)

The remaining 8 plugins + json-render-ui, and the community docs guide — each mirrors this shape.


Created with the help of an agent.

@antfubot antfubot changed the title feat(plugin-inspect): serve the SPA from a lockstep client-assets package feat(plugin-inspect): serve the SPA from a lockstep assets package Aug 16, 2026
Base automatically changed from feat/remote-client-assets to main August 16, 2026 22:45
…kage

Pilot of the deferred-client-assets pattern: the inspector's Vue SPA now
ships in a new @devframes/plugin-inspect-client package instead of inside
the node tarball, which drops from ~409 KB (90% SPA) to ~18 KB. Its Vite
build emits into plugins/inspect/client-pkg/dist, and cli.distDir points
at a RemoteAssets declaration (package + version + resolveFrom).

In this monorepo the client package is a dev-only workspace link, so
resolveFrom short-circuits to its built dist (zero network); published
consumers get the assets on demand through devframe's caching CDN
back-proxy, or by installing the client package for an offline/air-gap UI.

Wires the nested workspace glob (plugins/*/client-pkg), turbo outputs, a
knip override for the runtime-string dependency, and updates the plugin's
test harness to resolve the source.
'client' is overloaded in devframe (devframe/client is the RPC client;
each plugin's ./client export is its panel script), so a package holding
prebuilt browser assets reads wrong as '…-client'. Rename
@devframes/plugin-inspect-client -> @devframes/plugin-inspect-assets and
the directory client-pkg -> assets-pkg, and adopt '${pkg.name}-assets' as
the convention for deferred SPA-asset packages.
Separate the '--assets' companion suffix from the plugin's own name
segments: @devframes/plugin-inspect-assets -> @devframes/plugin-inspect--assets.
The '--' makes the auto-derived assets package visually distinct from a
plugin whose name legitimately ends in a single-dash segment. Convention
is now '${pkg.name}--assets'; the directory stays plugins/*/assets-pkg.
@antfu
antfu force-pushed the feat/plugin-inspect-client branch from 3687968 to ea86409 Compare August 16, 2026 22:45
@netlify

netlify Bot commented Aug 16, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

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

@antfu
antfu merged commit 62acb86 into main Aug 16, 2026
12 checks passed
@antfu
antfu deleted the feat/plugin-inspect-client branch August 16, 2026 22:52
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