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

waystone

v0.2.6

Published

MPAs that feels like SPAs

Readme

waystone

MPAs that feels like SPA

NPM JavaScript Style Guide

Install

npm i waystone
yarn add waystone
pnpm add waystone

Usage

import 'waystone';

NOTE: Waystone is required to only run once, so it's ideal to serve it on JS files where the module is going to be instanciated once.

Replace instead of Push

You can use ws:replace to replace the History state rather than push when navigating

<a href="/my-page" ws:replace>My page</a>

Scroll control

By default, anchor tags will scroll up instantly to the top of the page when navigated to. You can add ws:scroll="none" to preserve scroll or you can use ws:scroll="smooth" if you want the page to scroll up smoothly.

Prefetch strategies

You can add one of the following attributes to your anchor tags prefetch strategies:

  • ws:animation-frame: Prefetches through requestAnimationFrame
  • ws:delay="1000": Prefetches through setTimeout
  • ws:idle: Prefetches through requestIdleCallback
  • ws:interaction: Prefetches when the element receives focus, is hovered or about to be touched.
  • ws:load: Prefetches after the current window has loaded.
  • ws:media="(orientation: portrait)": Prefetches using media query
  • ws:ready-state="interactive": Prefetches using document.readyState
  • ws:visible: Prefetches when the element is visible in the viewport

Opting-out

You can add ws:disabled to your anchor element.

<a href="/my-page" ws:disabled>My Page</a>

Lifecycle Events

Waystone provides lifecycle events through on.

import { on } from 'waystone';

on('unload', () => {
  cleanupStuff();
});

Waystone lifecycle involves three steps:

  • beforeunload: This is called before unload happens. In this event, you can cancel the navigation by calling event.preventDefault()
on('beforeunload', (event) => {
  const prompt = window.confirm('Are you sure you want to leave?');

  if (!prompt) {
    event.preventDefault();
  }
})
  • unload: This is called before the document is replaced.
  • load: This is called after the document is replaced.

DOM diffing

Please use with caution!

By default, waystone replaces the entire page when navigating to a new one, which means that every element from the previous page would get disposed. If you want to skip elements that are similar from the previous page (or any page), you can add ws:diff to your <html>.

<html ws:diff>
  ...
</html>

ws:diff utilizes morphdom and DOMParser.

The difference, however, would be:

  • Scripts will no longer run on the new page.
  • window's DOMContentLoaded and load events wouldn't work.

Live demos

  • Basic Astro demo Open in CodeSandbox
  • Astro Blog template demo Open in CodeSandbox

License

MIT © lxsmnsyc