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

@logbrew/browser

v0.1.0

Published

Browser error, page-view, and fetch transport helpers for the public LogBrew JavaScript SDK.

Readme

@logbrew/browser

Browser helpers for the public LogBrew JavaScript SDK.

This package captures page views, synchronous browser errors, and unhandled Promise rejections while keeping validation, buffering, retry, flush, and shutdown behavior in @logbrew/sdk.

Install

npm install @logbrew/sdk @logbrew/browser
pnpm add @logbrew/sdk @logbrew/browser

Browser Setup

import { installLogBrewBrowser } from "@logbrew/browser";

const logbrew = installLogBrewBrowser({
  clientKey: "LOGBREW_BROWSER_KEY"
});

logbrew.client.log("evt_log_001", new Date().toISOString(), {
  message: "browser app started",
  level: "info",
  logger: "browser"
});

installLogBrewBrowser() attaches error and unhandledrejection listeners with addEventListener(), captures an initial page-view span, flushes queued events when the page becomes hidden or receives pagehide, and returns a handle with client, flush(), shutdown(), previewJson(), and uninstall().

For browser apps, prefer a browser-scoped public key through clientKey. apiKey is still accepted for compatibility with lower-level SDK examples and tests.

By default, browser metadata keeps the current path without query string or hash. It does not include document title or user agent unless includeDocumentTitle or includeUserAgent is enabled. Pass sanitizeMetadata(metadata, kind) to remove or rewrite metadata before events are queued.

Set flushOnPageHide: false or flushOnVisibilityHidden: false if your app wants to own page lifecycle delivery itself.

Fetch Transport

import { createFetchTransport, installLogBrewBrowser } from "@logbrew/browser";

installLogBrewBrowser({
  clientKey: "LOGBREW_BROWSER_KEY",
  transport: createFetchTransport({
    endpoint: "https://api.logbrew.com/v1/events"
  })
});

For tests and local examples, use RecordingTransport.alwaysAccept() from @logbrew/sdk so no network call is made.

Trace Propagation

Use createTraceparentFetch() when the browser app should connect frontend work to backend traces. Propagation is target-scoped by default: no traceparent header is attached unless the request URL matches tracePropagationTargets.

import {
  createBrowserTraceparent,
  createTraceparentFetch
} from "@logbrew/browser";

const tracedFetch = createTraceparentFetch({
  traceparentFactory: () => createBrowserTraceparent(),
  tracePropagationTargets: [
    "https://api.example.com/",
    /^\/api\//
  ]
});

await tracedFetch("/api/checkout", {
  method: "POST",
  body: JSON.stringify({ cartId: "cart_123" })
});

tracePropagationTargets accepts strings, regular expressions, or (url) => boolean functions. Match as narrowly as possible so browser requests do not send tracing headers to unrelated origins. If the API is on another origin, configure that backend's CORS policy to allow the traceparent request header.

Packaged Examples

After install, these commands are available from a consumer app:

node node_modules/@logbrew/browser/examples/index.mjs --help
node node_modules/@logbrew/browser/examples/index.mjs --list
node node_modules/@logbrew/browser/examples/index.mjs readme-example
node node_modules/@logbrew/browser/examples/index.mjs real-user-smoke
node node_modules/@logbrew/browser/examples/index.mjs
npm --prefix node_modules/@logbrew/browser/examples run help
npm --prefix node_modules/@logbrew/browser/examples run list
npm --prefix node_modules/@logbrew/browser/examples run readme-example
npm --prefix node_modules/@logbrew/browser/examples run real-user-smoke

The default launcher path runs real-user-smoke.