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

@torba/core

v1.0.5

Published

Data model for Torba manifests. Types, factory functions, Zod parsers, and encode/decode utilities. No I/O.

Readme

@torba/core

Data model for Torba manifests. Types, factory functions, Zod parsers, and encode/decode utilities. No I/O.

Install

npm install @torba/core @torba/rules zod

Types

Source — artifact origin

type Source =
  | { kind: 'url'; url: string }
  | { kind: 'file'; file: string }
  | { kind: 'string'; string: string }
  | { kind: 'empty' };

// Factory functions
sourceUrl('https://example.com/file.jar');
sourceFile('./local/file.jar');
sourceString('inline content');
sourceEmpty();

// Parse / encode
SourceSchema.parse(raw);
encodeSource(source);

ExtractRule — zip extraction instructions

type ExtractRule =
  | { kind: 'pick'; file: string; into: string }          // single file
  | { kind: 'scan'; matches: string; into: string; ... }  // glob match
  | { kind: 'dump'; into: string; clean?: boolean; ... }  // full extract

// Factory functions
extractPick('lwjgl.dll', '${natives_directory}')
extractScan('*.so', '${natives_directory}', { excludes: ['META-INF/'] })
extractDump('${natives_directory}', { clean: true, excludes: ['META-INF/'] })

// Parse / encode
ExtractSchema.parse(raw)          // always returns ExtractRule[]
encodeExtract(rules)

Artifact — a single installable artifact

An artifact has a source, optional integrity/size checks, optional extract rules, and optional rulesets that gate it per platform or feature.

import { ArtifactSchema, encodeArtifact } from '@torba/core';

const artifact = ArtifactSchema.parse(raw);
encodeArtifact(artifact);

Manifest — the manifest

interface Manifest {
  vars: ValDefs;
  launch?: Launch;
  artifacts: ReadonlyArray<Artifact>;
}

// Parse JSON string
const manifest = await parseManifest(jsonString);

// Filter to current platform
const filtered = filterManifest(manifest, { name: 'linux', arch: 'x64' });

// Encode back to JSON-serializable object
encodeManifest(manifest);

ValDefs — interpolation variables

Variables support OS-conditional values and ${ref} interpolation.

import {
  parseValDefs,
  encodeValDefs,
  resolveValDefs,
  resolveVars,
} from '@torba/core';

const defs = parseValDefs(raw);
const flat = resolveValDefs(defs, platform); // pick OS-appropriate values
const vars = resolveVars(flat); // resolve ${ref} chains
const result = interpolate('${root}/assets', vars);

defineConfig — config file helper

Used as the default export in torba.config.mjs:

import { defineConfig } from '@torba/core';

export default defineConfig({
  artifacts: [...],
  vars: [...],
  command: { ... },
  output: 'torba.json',
});

// Or as a function for context-aware configs
export default defineConfig((ctx) => ({
  artifacts: ctx.mode === 'build' ? [...] : [],
}));