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

@zeropress/build-core

v0.5.2

Published

Shared ZeroPress build core

Downloads

2,568

Readme

@zeropress/build-core

npm license node

Shared build core for ZeroPress.

This package is the deterministic rendering engine used by:

It accepts canonical preview-data plus a validated theme package and produces static HTML artifacts through a writer interface.

preview-data stays canonical and data-only. Build-core computes the render-ready route state that themes consume at render time. Actual artifact output is the intersection of:

  • renderable preview-data entries
  • theme template capability

Install

npm install @zeropress/build-core

Exports

import {
  buildSite,
  buildSiteFromThemeDir,
  MemoryWriter,
  FilesystemWriter,
} from '@zeropress/build-core';

Purpose

@zeropress/build-core is responsible for:

  • validating preview-data input
  • validating in-memory theme packages
  • computing paginated routes from content data
  • computing theme-facing render data such as post lists, taxonomy links, pagination, and formatted timestamps
  • rendering route HTML
  • processing theme assets
  • generating special files such as:
    • sitemap.xml
    • feed.xml
    • fallback robots.txt
  • writing outputs through a pluggable writer

It does not:

  • fetch content from databases or APIs
  • package or validate theme directories on its own unless the caller uses buildSiteFromThemeDir
  • watch files, run a dev server, or perform deployment
  • talk to queues, KV, Durable Objects, R2, GitHub, or other infrastructure directly

Core APIs

buildSite(input)

Renders a full static artifact from preview-data and a theme package.

import { buildSite, MemoryWriter } from '@zeropress/build-core';

const writer = new MemoryWriter();

const result = await buildSite({
  previewData,
  themePackage,
  writer,
  options: {
    writeManifest: true,
  },
});

Returns:

{
  files: [
    {
      path: 'index.html',
      contentType: 'text/html',
      size: 1234,
      sha256: '...'
    }
  ],
  manifest: {
    generatedAt: '2026-04-02T00:00:00Z',
    files: [
      {
        path: 'index.html',
        contentType: 'text/html',
        size: 1234,
        sha256: '...'
      }
    ]
  }
}

Notes:

  • writer is required
  • previewData must already satisfy the canonical preview-data contract
  • themePackage must already be a validated in-memory theme package
  • sitemap.xml and feed.xml are emitted only when site.url is a non-empty canonical URL
  • fallback robots.txt is emitted when generateSpecialFiles is enabled and generateRobotsTxt is not false
  • fallback robots.txt uses site.indexing; false emits Disallow: /, while missing or true emits Allow: /
  • callers that disable fallback robots because a public robots.txt exists should copy that file as-is; sitemap directives in custom robots files are caller/user responsibility

buildSiteFromThemeDir(input)

Loads a theme directory from disk and renders it using the same core pipeline.

This is useful for local tooling that wants filesystem theme loading but still uses the same deterministic core renderer.


Writers

MemoryWriter

Collects generated files in memory.

Best for:

  • tests
  • comparisons
  • in-process orchestration

FilesystemWriter

Writes generated files to a target directory.

Best for:

  • local output generation
  • CLI workflows

Input Contracts

Preview Data

previewData must satisfy the canonical ZeroPress preview-data contract enforced by:

Theme Package

themePackage must contain:

  • metadata
  • templates
  • partials
  • assets

Theme validation is enforced through:

buildSiteFromThemeDir() is the convenience entry point that loads a theme directory and converts it into the required in-memory themePackage.

JavaScript theme assets are emitted as provided. Build-core may hash output filenames, but it does not rewrite or minify JavaScript content.

As of preview-data v0.4, the payload no longer carries routes arrays or raw HTML fragments such as categories_html.

Build-core now derives:

  • index/archive/category/tag routes
  • post list HTML blocks
  • pagination HTML
  • taxonomy link HTML
  • formatted published_at / updated_at
  • reading_time
  • comments_enabled

It also emits a comments allowlist artifact:

  • /_zeropress/comment-policy.json

Comment availability is derived from preview-data policy:

  • site.disallowComments
  • content.posts[].allow_comments

The canonical preview-data v0.4 site contract uses:

  • site.locale
  • site.timezone
  • site.disallowComments

Optional route templates behave as rendering capabilities, not guaranteed outputs:

  • archive.html
  • category.html
  • tag.html
  • 404.html

If preview-data includes content that could produce archive/category/tag pages but the theme omits the matching optional template, build-core skips those outputs. Special files are derived from emitted outputs rather than raw preview-data alone.


Build Options

Supported options:

  • assetHashing
  • generateSpecialFiles
  • generateRobotsTxt
  • writeManifest

These options apply to both full builds and partial renders where relevant.

Defaults:

  • assetHashing: true
  • generateSpecialFiles: true
  • generateRobotsTxt: true
  • writeManifest: false

Requirements

  • Node.js >= 18.18.0
  • ESM only

Related


License

MIT