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

@piwitests/instrumentation

v0.12.0

Published

Nitro/Nuxt server plugin for sending backend logs to Piwi Dashboard via the X-Piwi-Logs response header

Downloads

1,463

Readme

@piwitests/instrumentation

Nitro / Nuxt server plugin for Piwi Dashboard — captures Warning and Error log entries per HTTP request and delivers them to the Piwi Dashboard reporter via the X-Piwi-Logs response header.

During a Playwright test run, the reporter reads this header from every response and stores the entries alongside the network request. The entries are then available in the Piwi Dashboard test-case view and are included in the AI diagnosis context.

Active only when NODE_ENV !== 'production'. No header is emitted in production builds.

Installation

npm install @piwitests/instrumentation

Usage

Create a file in your project's server/plugins/ directory:

// server/plugins/piwi-test-logs.ts
export { default } from '@piwitests/instrumentation'

That's all. Nitro auto-loads all files in server/plugins/ on startup.

What gets captured

| Source | What is captured | |--------------------------------------|------------------------------------------------| | consola.warn() / consola.error() | Warning and Error entries logged via consola | | Unhandled H3/Nitro errors | Errors thrown in route handlers and middleware |

Each captured entry contains:

| Field | Description | |-------------|-------------------------------------------| | timestamp | Unix timestamp in milliseconds | | level | "Warning" or "Error" | | category | Logger tag/category (e.g. "database") | | message | Log message (truncated at 500 characters) |

Up to 50 entries per request are included. The header is always emitted (with an empty array when no entries were captured) so the Piwi reporter can confirm the plugin is active.

How it works

Playwright test
  └─ page.goto('/api/orders')
       └─ Nitro route handler runs
            ├─ consola.warn('Stock low')     ← captured via consola reporter
            └─ HTTP response
                 └─ X-Piwi-Logs: <gzip+base64 JSON>
                      └─ Piwi reporter reads header
                           └─ stored as serverLogs on the network request
                                └─ visible in test-case detail + AI diagnosis

The plugin uses three mechanisms:

  1. event.context._piwiLogs — a plain array attached to the H3 event, readable by both the request and beforeResponse hooks via the same event object (no async-context propagation needed).
  2. AsyncLocalStorage — seeded in the request hook so that consola reporters can append to the per-request buffer from within synchronous route-handler code.
  3. error hook — catches unhandled Nitro/H3 errors that bypass consola.

Peer dependencies

| Package | Version | |-------------|-----------| | nitropack | >=2.0.0 | | h3 | >=1.0.0 | | consola | >=3.0.0 |

These are already installed in any Nuxt project — no extra installs needed.

Building from source

cd integrations/nitro
npm run build   # emits dist/index.js + dist/index.d.ts

License

MIT