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

@atarashi/core

v1.0.0

Published

The Atarashi generation engine: resolve, render, merge, plan, write.

Downloads

125

Readme

@atarashi/core

The Atarashi generation engine. Takes a ProjectSpec, returns a GenerationPlan. Pure: it never calls process.exit, never writes to stdout, never prompts, and never touches disk until you explicitly commit a plan.

import { generate, commit, runActions } from '@atarashi/core';

const plan = await generate(spec, { source: registry, atarashiVersion: '1.0.0' });
if (!plan.ok) {
    for (const d of plan.error.diagnostics) console.error(d.message);
    process.exit(1);
}

// Everything above is side-effect free; this is where the disk is touched.
const written = commit(plan.value, '/path/to/my-api');
await runActions(plan.value, spec, { targetDir: '/path/to/my-api' });

The pipeline

| Stage | What it does | |---|---| | resolve | Selected ids → an ordered, validated blueprint graph. Expands requires, auto-adds unambiguous providers, detects conflicts and cycles, checks engines. | | buildContext | One frozen object read by every template and every when expression. | | render | Per-file when, path templating, Handlebars with a curated helper set → FileFragment[]. | | collect | Dependencies, scripts, env vars, gitignore lines and next steps → more fragments, so declarative content and templated content share one merge path. | | merge | Groups fragments by path and reduces them with the declared strategy; injects slot contributions. | | assemblePlan | Files + post-actions + warnings + dependency summary + atarashi.json. | | HookRunner | Runs beforeRender, afterRender and afterPlan in a sandboxed worker between the stages they are named for. | | validatePlan | Size caps, case collisions, path escapes, JSON/YAML syntax, undeclared env keys. | | commit | Stage to a temp dir, fsync, atomic rename, full rollback on any failure. |

Invariants worth preserving

  • The plan is a virtual filesystem. --dry-run, the web preview, the zip download and snapshot tests all fall out of this for free. If you add a stage, it operates on the VFS, not on disk.
  • Determinism. Identical inputs produce byte-identical output. Everything iterated is sorted; graph order is total (afterpriority → id).
  • No silent overwrites. Two blueprints writing one path is a conflict unless a strategy says otherwise.
  • Every path is checked twice: once when it enters the VFS, once against the resolved target directory before the writer moves anything.
  • Hook output is untrusted input. Anything a hook returns re-enters through the same normalization and the same validatePlan gate as rendered output.

Hooks

A blueprint may declare hooks: { module, exports, capabilities, timeoutMs }. Each hook runs in its own node:worker_thread with:

  • an empty environment (env: {}), no argv, no execArgv, and no fetch, WebSocket or XMLHttpRequest;
  • a module loader that allows only pure builtins (path, url, util, buffer, assert, events, querystring, string_decoder) and refuses any import resolving outside the blueprint's own directory;
  • a hard timeout (the manifest's timeoutMs, capped at 30 s) after which the worker is terminated;
  • only what its capabilities allow: read-files to see the file list, write-files for its changes to be kept, read-context to receive the render context.

A hook never touches the filesystem. It mutates a structured clone of its subject and the runner copies back the permitted fields. Blueprints from untrusted sources need explicit consent (hooks.consent), and --no-hooks (hooks.enabled: false) skips every hook with a warning rather than failing.

The when expression language

A small non-Turing-complete language, parsed to an AST and interpreted, never eval'd. Bindings: answers.*, project.*, options.*, pm.*, has(id), provides(capability). Operators: && || ! === !== < <= > >= + - and in. No member calls, no loops, no property access on call results.