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

@polterware/pwa

v1.1.6

Published

Headless PWA install utilities and manifest tools for modern web apps

Readme

Header

@polterware/pwa

npm version License: MIT TypeScript

Headless PWA install utilities and manifest tools for modern web apps.

Overview

@polterware/pwa v2 is centered around install environment detection instead of UI components.

  • Detect the current install environment with browser-aware rules
  • Use native install prompts when the browser exposes beforeinstallprompt
  • Show manual guides only for verified flows such as iOS Safari and Safari on macOS
  • Keep manifest generation in a dedicated module
  • Use React hooks without forcing a button, modal, or layout

Installation

npm install @polterware/pwa

For React integration:

npm install react react-dom

Package Entry Points

import {
  detectInstallEnvironment,
  getInstallGuide,
} from "@polterware/pwa";

import { usePWAInstall } from "@polterware/pwa/react";

import {
  generateManifest,
  mergeManifest,
} from "@polterware/pwa/manifest";

Browser Matrix

| Browser / OS | Install strategy | Notes | | --- | --- | --- | | Safari on iOS | Manual guide | Uses ios_share_sheet | | Safari on macOS | Manual guide | Uses safari_add_to_dock | | Chrome desktop | Native prompt | Available only after beforeinstallprompt | | Edge desktop | Native prompt | Available only after beforeinstallprompt | | Samsung Internet | Native prompt | Available only after beforeinstallprompt | | Arc desktop | Unsupported | No manual fallback is generated | | Firefox / unknown browsers | Unsupported | No guessed instructions |

Quick Start

Vanilla TypeScript

import {
  detectInstallEnvironment,
  getInstallGuide,
} from "@polterware/pwa";

const environment = detectInstallEnvironment();
const guide = getInstallGuide(environment.guideId, { locale: "en" });

if (environment.availability === "manual" && guide) {
  console.log(guide.title);
  console.log(guide.steps);
}

React

import { usePWAInstall } from "@polterware/pwa/react";

export function InstallCallout() {
  const { canPrompt, promptInstall, status, guide } = usePWAInstall({
    locale: "en",
  });

  if (status === "installed" || status === "unsupported") {
    return null;
  }

  if (canPrompt) {
    return (
      <button onClick={() => void promptInstall()}>
        Install app
      </button>
    );
  }

  if (!guide) {
    return null;
  }

  return (
    <section>
      <h2>{guide.title}</h2>
      <p>{guide.description}</p>
      <ol>
        {guide.steps.map((step) => (
          <li key={step.number}>
            <strong>{step.title}</strong>
            <p>{step.description}</p>
          </li>
        ))}
      </ol>
    </section>
  );
}

Runtime API

detectInstallEnvironment(): InstallEnvironment

Returns a browser-aware snapshot of the current runtime.

const environment = detectInstallEnvironment();

// {
//   os: "windows",
//   browser: "chrome",
//   isInstalled: false,
//   availability: "unavailable",
//   reason: "criteria_unmet",
//   guideId: null
// }

getInstallGuide(guideId, config?): InstallGuide | null

Returns manual install content only for supported guide ids.

const guide = getInstallGuide("ios_share_sheet", {
  locale: "en",
});

usePWAInstall(options?): UsePWAInstallReturn

React hook that combines environment detection, deferred prompt lifecycle, and guide lookup.

const {
  environment,
  canPrompt,
  promptInstall,
  status,
  guide,
} = usePWAInstall();

The hook:

  • captures beforeinstallprompt
  • exposes canPrompt
  • runs promptInstall() only when a deferred prompt exists
  • reacts to appinstalled
  • keeps manual guides and native prompts mutually exclusive

Manifest Module

The manifest helpers now live in @polterware/pwa/manifest.

import {
  generateManifest,
  mergeManifest,
} from "@polterware/pwa/manifest";

const manifest = generateManifest({
  name: "Polterware",
  short_name: "Polter",
  description: "Headless PWA install flow",
  start_url: "/",
  icons: [
    {
      src: "/icons/icon-192x192.png",
      sizes: "192x192",
      type: "image/png",
      purpose: "any maskable",
    },
  ],
});

CLI

Create or update manifest.json interactively:

npx @polterware/pwa init

Custom manifest path:

npx @polterware/pwa init --manifest-path public/manifest.json

Public Types

type OperatingSystem =
  | "ios"
  | "android"
  | "macos"
  | "windows"
  | "linux"
  | "other";

type Browser =
  | "safari"
  | "chrome"
  | "arc"
  | "edge"
  | "firefox"
  | "samsungInternet"
  | "other";

type InstallAvailability =
  | "native"
  | "manual"
  | "unsupported"
  | "unavailable";

type InstallGuideId = "ios_share_sheet" | "safari_add_to_dock";

Breaking Changes in v2

These APIs are no longer part of the main public surface:

  • detectPlatform
  • getInstallInstructions
  • usePWA
  • usePlatform
  • useIsInstalled
  • InstallPrompt

The library now expects the application to own the button, modal, and install UI.