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

@site-index/core

v0.1.5

Published

Deterministic site-index pipeline: config, discovery, loading, validation, and artifact generation.

Readme

@site-index/core

Deterministic site-index pipeline for config resolution, discovery, loading, validation, deduplication, and artifact generation.

npm version Code Quality Code Coverage Socket

Repository README

Install

npm install @site-index/core

Requirements:

  • Node.js >=22

When to use

Use @site-index/core when you need programmatic control and can provide module loading yourself.

When not to use

Public exports

export { Artifact } from "./domains/artifacts/artifact.js";
export type { LoadModule, Options } from "./domains/options/types.js";
export type * from "./domains/site-indexes/types.js";
export type { Warning, Result } from "./types.js";
export { main } from "./main.js";

Main API

main(options: Options): Promise<Result<Artifact[]>>

Options:

type Options = {
  siteUrl: string;
  rootPath: string;
  extensions?: string[] | undefined;
  loadModule: LoadModule;
};

LoadModule:

type LoadModule = (module: Module) => Promise<ModuleExports>;

Module:

type Module = {
  filePath: string;
  importId: string;
};

ModuleExports:

type ModuleExports = {
  siteIndexes: SiteIndex[];
};

Site index type

type SiteIndex = {
  url: `/${string}`;
  lastModified?: string | undefined;
  sitemap?: string | undefined;
  index?: boolean | undefined;
};

Validation rules:

  • url must start with /
  • url cannot contain query strings or fragments
  • lastModified is optional
  • lastModified must be an ISO date or an ISO datetime with offset
  • sitemap is optional
  • sitemap defaults to pages
  • sitemap must be lowercase and can include hyphens
  • index is optional
  • index defaults to true
  • index: false excludes the URL from sitemap artifacts and adds Disallow: <path> to robots.txt

Artifacts

Generated:

  • sitemap.xml
  • sitemap-<name>.xml
  • robots.txt

Artifact content types:

  • .xml -> application/xml; charset=utf-8
  • .txt -> text/plain; charset=utf-8

Pipeline behavior

main(...):

  • resolves options
  • discovers *.site-index.* modules
  • loads modules via caller-provided loadModule
  • validates module exports
  • resolves and deduplicates site index entries
  • sorts output deterministically
  • generates immutable artifacts
  • returns warnings for recoverable issues

Warning categories include:

  • no modules found
  • failed module load
  • invalid module exports
  • duplicate URL entries

Example

Example with a runtime that can import the discovered module files:

import { main } from "@site-index/core";
import type { Module, ModuleExports } from "@site-index/core";

const result = await main({
  siteUrl: "https://example.com",
  rootPath: process.cwd(),
  extensions: [".mjs"],
  loadModule: async (module: Module): Promise<ModuleExports> => {
    const loaded = await import(module.filePath);

    return loaded.default as ModuleExports;
  },
});

Related packages