Assets

Browse, preview, and manage files in a directory, porting Nuxt DevTools' Assets tab.

Browse, preview, and manage files in a directory, porting Nuxt DevTools' Assets tab.

Package: @devframes/plugin-assets · framework: Vue + @antfu/design

File browser and details panel

What it does

Search by name, filter by type, view as a thumbnail grid or tree, and open a details panel: live preview (image, video, audio, font, text), metadata, and copy-ready snippets (<img>, background-image, @font-face). Upload via toolbar or drag-and-drop, multi-select to delete; a watcher keeps listings synced.

The standalone server requires devframe's trust handshake; write is on by default ({ write: false } / --read-only for browse-only).

Standalone

pnpx @devframes/plugin-assets             # manages <cwd>/public
pnpx @devframes/plugin-assets --read-only # disable upload / rename / delete / mkdir

Mount into a Vite host

For a Vite DevTools app:

// vite.config.ts
import createAssetsDevframe from '@devframes/plugin-assets'
import { createPluginFromDevframe } from '@vitejs/devtools-kit/node'
import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [
    createPluginFromDevframe(createAssetsDevframe()),
  ],
})

Or use devframeVite from @devframes/vite/single.

Programmatic

createAssetsDevframe(options) returns a definition for any adapter:

import { createAssetsDevframe } from '@devframes/plugin-assets'

export default createAssetsDevframe({
  dir: 'static',
  baseURL: '/',
  write: true,
  uploadExtensions: ['png', 'jpg', 'svg', 'webp'], // or '*' for any
})
OptionDefaultDescription
dir<cwd>/publicDirectory to manage.
baseURL/URL base the user app serves dir at (e.g. Nuxt app.baseURL).
writetrueEnable upload, rename, delete, mkdir.
uploadExtensionsNuxt DevTools' allow-listExtensions upload accepts, or '*'.
serveStaticfalseServe the directory's bytes; on for the standalone CLI.
buildfalseRegisters the build subcommand (Static export).

How previews are served

Previews load by public URL (baseURL + path).

RPC

Namespaced devframes:plugin:assets:*:

FunctionTypeNotes
listquery, snapshot: trueEvery file: type, size, mtime.
capabilitiesquery, snapshot: trueWrite-enabled flag; the allow-list.
read-image-metaqueryWidth/height/orientation.
read-textqueryTruncated preview text; server-highlighted via @devframes/service-shiki, else plain <pre>.
uploadactionStreaming upload slot; the SPA pipes bytes.
renameactionRenames one (keeps extension).
deleteactionDeletes one or more.
mkdiractionCreates a folder + parents.
open-in-editor / reveal-in-folderactionOpen/reveal via @devframes/service-open; always registered.

upload / rename / delete / mkdir register only with write.

Static export

The build subcommand is disabled by default (capabilities: { build: false }). Pass { build: true } (or { force: true } to createBuild()) to bake the listing.

Source

plugins/assets