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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@wiajs/static

v1.4.12

Published

Plugin for Elysia for serving static folder

Readme

@wiajs/static

Plugin for elysia for serving static folder.

Installation

bun add @wiajs/static

使用说明

默认(推荐):动态通配符,生产环境也支持增/改/新目录的即时生效:

app.use(staticPlugin({
  assets: ['public', 'assets'], // 支持数组
  prefix: '/',                  // 根路径服务
  preCompressed: true,          // 若你的构建产出 .br/.gz
  redirect: true,               // 目录无斜杠时 301 补齐
  headers: { 'X-Powered-By': 'elysia-static' }
}))

预注册(小目录、高性能):

app.use(staticPlugin({
  assets: 'public',
  prefix: '/',
  alwaysStatic: true,           // 预注册
  staticLimit: 2000,            // 若超限会自动回退为动态
  extension: true,
  indexHTML: true
}))
app.use(staticPlugin({
  assets: ['public', 'assets'],
  prefix: '/',                 // 根路径服务
  preCompressed: true,
  enableHEAD: true,            // 需要 HEAD 就开;只用 GET 也可
  // 生产策略
  prewarmEnable: process.env.NODE_ENV === 'production',
  prewarmMaxFiles: 300,        // 预热最多 300 个
  cacheMaxEntries: 1000,       // 缓存上限
  cacheOvershoot: 200          // 超出 5200 时清理回 5000
}))

Example

import { Elysia } from 'elysia'
import { staticPlugin } from '@wiajs/static'

const app = new Elysia()
    .use(staticPlugin())
    .listen(8080)

Config

Below is an available config for a static plugin.

assets

@default "public"

Asset path to expose as a public path

prefix

@default '/public'

Path prefix to create a virtual mount path for the static directory

staticLimit

@defualt 1024

If total files exceed this number, the file will be handled via wildcard instead of the static route to reduce memory usage

alwaysStatic

@default boolean

If set to true, the file will always use a static path instead