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

@filamentjs/static-resources

v0.1.0

Published

Safe, conditional static resource routes for FilamentJS

Readme

@filamentjs/static-resources

Serve explicit static-resource manifests through FilamentJS, with multiple URL mounts backed by local files or injected stores. Secure filesystem and HTTP conditional-request behavior are included rather than delegated to handlers.

Key features

  • Multiple independent mounts such as /images, /js, and /downloads.
  • Safe filesystem store plus a small structural interface for other backends.
  • Exact GET and HEAD routes with ETag and If-Modified-Since validation.
  • Configurable on-demand metadata refresh (600, 600s, 10m, 1h, always, or never).
  • Bounded reads, dotfile/symlink protections, nosniff, and generic fail-closed store errors.

Quick start

npm install @filamentjs/static-resources filamentjs
import { createApp, type FrameworkMeta } from "filamentjs";
import { createFileSystemStore, setup, type ResourceStore } from "@filamentjs/static-resources";

declare const assetStore: ResourceStore;
const app = createApp<FrameworkMeta>(
  { application: { maxRequestSize: "1MiB" } },
  {},
);
await setup(app, {
  mounts: [
    {
      path: "/images",
      store: createFileSystemStore({ root: "./public/images" }),
      refresh: "10m",
    },
    { path: "/js", store: assetStore, refresh: 600 },
  ],
});

Requires Node 24+ and the exact supported peer [email protected].

How it works and options

The current Filament router has no wildcard route, so setup() enumerates each store and registers exact GET and HEAD routes. Existing paths can refresh; discovering new paths requires restart and setup again. Large manifests create large route tables and should be measured in the target application.

Refresh accepts seconds as a non-negative integer (600), 600s, 10m, 1h, always, or never. The default is 60 seconds. The interval limits metadata checks; it does not promise that an in-flight request observes a concurrent write.

Safe defaults deny dotfiles and filesystem symlinks, directory listings, ranges, SPA fallbacks, and implicit index files. Unknown media types are application/octet-stream; responses include nosniff. Files default to a 16 MiB limit. ETags take precedence over If-Modified-Since, whose comparison uses HTTP-date second precision. Store failures fail closed with a generic 503 and are sent to the configured error exporter.

Public API

| Surface | Meaning | | --- | --- | | setup(app, options) | Enumerates manifests and registers exact GET/HEAD routes; returns registered paths. | | createFileSystemStore(options) | Creates a bounded filesystem-backed structural store. | | ResourceStore, ResourceMetadata | Pluggable list/metadata/read contract. | | Mount | URL prefix, store, refresh, cache-control, metadata, dotfile, and byte-limit options. |

Each registered route handler owns and closes its response. It returns 304 for matching validators, 404 when a known resource disappears, and generic 503 on store failure. Authentication or authorization middleware must run before setup if mounts are private. Cache/security headers may run independently, but a terminal static handler is not transformed by Filament 0.6.

Development and demo

From a source checkout:

npm test
npm run example
npm run demo

The heavily annotated example registers the checked-in filesystem fixture. The unattended demo starts an in-memory server, performs GET, conditional GET, and HEAD requests, prints status/validator/body evidence, closes the server, and exits. There is no pre-0.1 migration contract.

License

ISC