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

@nisli/ssg

v0.4.0

Published

Static site generation tooling for Nisli publications.

Readme

@nisli/ssg

Static site generation tooling for Nisli publications.

Install

npm install @nisli/core @nisli/ssg

Build Toolkit

buildStaticSite() is the publication build spine. It writes route output, optionally copies public assets, and will own Nisli's component-to-static output internally. Applications should not import a separate static template API.

import { html } from '@nisli/core';
import { buildStaticSite } from '@nisli/ssg';

await buildStaticSite({
  outDir: 'dist',
  publicDir: 'public',
  context: { title: 'My site' },
  routes: [
    {
      path: '/',
      render: ({ title }) => html`<h1>${title}</h1>`,
    },
  ],
});

Route render functions may return either an existing HTML string or a normal @nisli/core html template result. SSG serializes Nisli template results internally at build time, so application templates should use the same html authoring API as browser components.

Application router builds

Pass an AppRouter from @nisli/router instead of a separate route array to share path matching, parameter decoding, query codecs, page rendering, and metadata with browser and Vite navigation.

import { html } from '@nisli/core';
import { buildStaticSite } from '@nisli/ssg';
import { defineRouter, notFound, route } from '@nisli/router';

const AppRouter = defineRouter({
  home: route('/', { render: () => html`<h1>Home</h1>` }),
  post: route('/posts/:slug', {
    entries: () => [{ slug: 'hello' }, { slug: 'second' }],
    render: ({ params }) => html`<article>${params.slug}</article>`,
  }),
  notFound: notFound({ render: () => html`<h1>Not found</h1>` }),
});

await buildStaticSite({
  outDir: 'dist',
  router: AppRouter,
  shell: ({ content, metadata }) => html`
    <!doctype html>
    <title>${metadata?.title}</title>
    <main>${content}</main>
  `,
});

Dynamic routes must provide entries(). Each entry is expanded with its typed href() and re-matched before rendering, so a build fails rather than silently using different URL rules. A configured not-found route is emitted as root 404.html. The optional shell receives the shared router metadata contract: title, named meta, property/OpenGraph metadata, canonical and alternate links, lang/dir, and keyed JSON-LD. SSG keeps this contract structural, so @nisli/router remains optional at runtime.

Output Helpers

Use the output helpers when adopting @nisli/ssg incrementally inside an existing publication pipeline.

import {
  cleanOutDir,
  copyPublicAssets,
  writeRoot,
  writeRoute,
} from '@nisli/ssg';

cleanOutDir('dist');
copyPublicAssets({ publicDir: 'public', outDir: 'dist' });
writeRoute('dist', 'about', '<main>About</main>');
writeRoot('dist', 'feed.xml', '<rss />');

writeRoute() writes page routes to index.html files:

  • / -> dist/index.html
  • /about -> dist/about/index.html
  • posts/hello -> dist/posts/hello/index.html
  • /404.html -> dist/404.html

writeRoot() writes root-level artifacts such as feeds, sitemaps, JSON files, and llms.txt. Route and root-file helpers reject path traversal.

Long term, this package is where Nisli's SSG tooling belongs. @nisli/core stays focused on component authoring and the browser runtime.