npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vite-asset-manager/core

v1.0.6

Published

Core functionality for vite-plugin-asset-manager

Readme

@vite-asset-manager/core

Core functionality for vite-plugin-asset-manager — the visual asset management dashboard for Vite projects.

This package provides the scanning, API, middleware, and service layer that powers the main plugin and framework integrations (Nuxt, Next.js).

Note: Most users should install vite-plugin-asset-manager directly. This package is for building custom integrations or framework adapters.

Installation

npm install @vite-asset-manager/core
# or
pnpm add @vite-asset-manager/core

What's Included

Services

| Service | Description | |---------|-------------| | AssetScanner | File discovery using fast-glob with chokidar file watching | | ImporterScanner | Detects which source files import each asset (ES imports, dynamic imports, require, CSS url, HTML attributes) | | DuplicateScanner | Content-based duplicate detection using MD5 hashing with streaming support | | ThumbnailService | Sharp-powered thumbnail generation with dual-tier caching (memory + disk) | | launchEditor | Opens files in your editor at a specific line/column | | revealInFileExplorer | Cross-platform utility to reveal files in Finder/Explorer |

API & Middleware

| Export | Description | |--------|-------------| | createApiRouter | HTTP API router with modular handlers for assets, files, system operations, and bulk actions | | broadcastSSE | Server-Sent Events broadcaster for real-time file change notifications | | createAssetManagerMiddleware | Connect-compatible middleware factory that serves the API and dashboard UI |

Orchestrator

| Export | Description | |--------|-------------| | AssetManager | High-level orchestrator that initializes and coordinates all services |

Usage

import {
  AssetManager,
  createAssetManagerMiddleware,
  broadcastSSE,
  type AssetManagerOptions
} from '@vite-asset-manager/core'

// Initialize
const manager = new AssetManager({
  root: process.cwd(),
  options: {
    base: '/__asset_manager__',
    include: ['src', 'public'],
    exclude: ['node_modules', '.git', 'dist'],
    watch: true,
    launchEditor: 'code',
  }
})

await manager.init()

// Set up file watching with SSE broadcasting
manager.setupWatchers(broadcastSSE)

// Create Connect-compatible middleware
const middleware = createAssetManagerMiddleware({
  base: '/__asset_manager__',
  scanner: manager.scanner,
  importerScanner: manager.importerScanner,
  duplicateScanner: manager.duplicateScanner,
  thumbnailService: manager.thumbnailService,
  root: process.cwd(),
  launchEditor: 'code',
})

// Use with any Node.js HTTP server
server.use(middleware)

// Cleanup
manager.destroy()

API Endpoints

The middleware serves these endpoints at {base}/api/:

| Endpoint | Method | Description | |----------|--------|-------------| | /assets | GET | List all assets | | /assets/grouped | GET | Assets grouped by directory | | /search?q= | GET | Search by name/path | | /thumbnail?path= | GET | Get image thumbnail | | /file?path= | GET | Serve original file | | /stats | GET | Asset statistics | | /importers?path= | GET | Files importing the asset | | /duplicates?hash= | GET | Assets with matching content hash | | /open-in-editor | POST | Open file in editor | | /reveal-in-finder | POST | Reveal in system file explorer | | /bulk-download | POST | Download as ZIP | | /bulk-delete | POST | Delete multiple assets | | /events | GET | SSE stream for real-time updates |

Types

All shared types are exported from this package:

import type {
  Asset,
  AssetGroup,
  AssetType,
  AssetManagerOptions,
  ResolvedOptions,
  AssetStats,
  Importer,
  ImportType,
  EditorType,
  DuplicateInfo,
  AdvancedFilters,
} from '@vite-asset-manager/core'

Requirements

  • Node.js >= 22
  • Sharp (bundled as dependency for thumbnail generation)

Related

License

MIT