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

@hover-dev/widget-bootstrap

v0.5.0

Published

Low-level helper that builds the Hover floating-chat widget's inline-script bundle. Used by Hover's bundler plugins (vite-plugin-hover, future webpack/Next/Astro plugins). End users probably want one of those plugins instead.

Readme

@hover-dev/widget-bootstrap

Low-level helper that builds the inline-script bundle for Hover's floating chat widget.

This package is for plugin authors. End users should install one of the official bundler plugins instead:

Future plugins (webpack-plugin-hover, next-plugin-hover, etc.) will consume this same package to produce a byte-identical widget bundle regardless of the host bundler.

What this package owns

  • The four widget source files (template.html, style.css, client.js, reducer.js) that make up the floating chat widget.
  • An mtime-keyed cache that re-reads + re-transforms the files only when they change on disk (preserving the "edit a widget file → reload page → see change" dev loop without paying for the read on every page request).
  • The exact preamble (window.__HOVER_PORT__, window.__HOVER_CSS__, window.__HOVER_HTML__) the widget client expects on boot.
  • The two regex-replace passes that strip ESM export keywords from reducer.js so it can concatenate cleanly into the widget IIFE.

Public API

Three layers, high → low. Pick the one that matches what your host bundler can do.

import {
  getWidgetScript,
  buildWidgetBundle,
  readWidgetAssets,
} from '@hover-dev/widget-bootstrap';

// High: returns a Vite HtmlTagDescriptor. One-liner inside transformIndexHtml.
const tag = getWidgetScript({ port: () => servicePort });

// Mid: preamble + body strings. Assemble your own <script> tag — useful for
// webpack's HtmlWebpackPlugin, Next.js _document, or a raw HTTP server.
const { preamble, body } = buildWidgetBundle({ port: 51789 });

// Low: raw, mtime-cached asset bytes. Webpack plugins may prefer this so the
// widget assets become real Compilation assets instead of inline script.
const { html, css, js, reducer } = readWidgetAssets();

port accepts a thunk

Pass either a number or a () => number. Vite's transformIndexHtml needs the latter because the actual bound port isn't known until configureServer finishes (auto-bump from 51789 if the port is busy). Other bundlers usually have a stable port and can pass a number directly.

transformBody hook

getWidgetScript and buildWidgetBundle both accept an optional transformBody: (body: string) => string callback. This is the seam for the future v0.3.x "click element → fix prompt" feature: per-host source-attribution injection (React fiber _debugSource, Vue data-v-inspector, framework-agnostic data-hover-source) plugs in here. The bootstrap package itself stays unaware of any framework.

License

Apache-2.0 — same as the rest of Hover.