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

@emulators/core

v0.12.2

Published

HTTP server, in-memory store, plugin interface, and middleware for emulate service plugins.

Readme

@emulators/core

HTTP server, in-memory store, plugin interface, and middleware for emulate service plugins.

Part of emulate — local drop-in replacement services for CI and no-network sandboxes.

The internal HTTP layer builds on Hono's API and design. Thank you to Yusuke Wada and the Hono contributors. See THIRD_PARTY_NOTICES.md for Hono's copyright and MIT license notice, also included in this npm package.

Install

npm install @emulators/core

Overview

The core provides the shared infrastructure that every @emulators/* service plugin builds on:

  • Store — a generic in-memory store with typed Collection<T> instances supporting CRUD, indexing, filtering, and pagination
  • Server — HTTP server with automatic port management; serve listens on 127.0.0.1 by default and accepts an explicit hostname for network access
  • Middleware — bearer token auth, error handling, CORS
  • UI — shared authorization/consent page rendering with bundled fonts
  • Persistence — pluggable save/load adapters for state durability

Persistence

File persistence

For local development, use the built-in file adapter:

import { filePersistence } from '@emulators/core'

persistence: filePersistence('.emulate/state.json')

Custom adapter

Any object with load and save methods works. Add initialize when a service generates durable identity:

const kvAdapter = {
  async load() { return await kv.get('emulate-state') },
  async save(data: string) { await kv.set('emulate-state', data) },
  async initialize(data: string) { // atomic create-or-read
    await kv.set('emulate-state', data, { nx: true })
    return (await kv.get('emulate-state'))!
  },
}

The persistence adapter is called on cold start (load) and after every mutating request (save). Saves are serialized via an internal queue to prevent race conditions.

Links

Custom emulators

Pass a definition created with defineEmulator from emulate to services[name].emulator in framework adapters. The same definition runs through the CLI and createEmulator({ service: definition, listen: false }) in tests. Custom entries accept an optional inspector and persistence adapter. Streamed response bodies persist state changes on completion or cancellation, and reset and close cancel active streams before cleanup. Appended Set-Cookie headers retain cookies already on a response. Keep state inside the definition's state factory, and await the handler's close() in tests. See the custom emulator guide.