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

@kanonak-protocol/codec

v0.4.0

Published

The generic Kanonak codec runtime: builds the canonical input model from typed nodes + an embedded schema, content-addresses it via @kanonak-protocol/canonical, and serializes/deserializes the normalized-JSON wire form. Referenced by generated typed SDKs;

Readme

@kanonak-protocol/codec

The generic, ontology-independent codec runtime referenced by Kanonak's generated typed SDKs. It turns typed objects into Kanonak content addresses and the normalized-JSON wire form, given the per-package CodecSchema that a generated SDK embeds.

It is the TypeScript port of the codec runtime. The C#/Rust/Go/Java/Python ports reference their kanonak-canonical library for the same canonical-hash entry; TypeScript references @kanonak-protocol/canonical — its only dependency.

What it does

  • packageContentHash(nodes, schema, pkg)sha256:… — the permanent content address of the package those nodes form. Builds the language-neutral canonical input model (kanonak.org/canonical-form) and hashes it via @kanonak-protocol/canonical. Byte-identical to kanonak hash of the equivalent authored .kan.yml, including the synthesized rdf:type triples and the package-wrapper subject.
  • packageCanonicalForm(nodes, schema, pkg) — the canonical form itself (the {subjects:[…]} JSON), for inspection/debugging.
  • serialize(node) / deserialize(json, schema) — the normalized-JSON wire form. Open-world assertions outside the type-model round-trip losslessly through $extra (top-level wire fields, collected under $extra on the typed node — [JsonExtensionData] semantics).

Self-contained by design

Carriers come from the schema's datatype URIs, and the resolved foundation URIs (type/label predicates, the Package class) are embedded by the generator — so hashing needs no runtime ontology resolution and no registry access. A generated SDK plus this library (and its one @kanonak-protocol/canonical dependency) is enough to content-address typed objects in a serverless/edge runtime.

Shape

import { packageContentHash, serialize, deserialize } from '@kanonak-protocol/codec';
import type { CodecSchema, CodecNode, PackageContext } from '@kanonak-protocol/codec';

// `Schema` is the constant a generated SDK embeds for its own classes.
const hash = packageContentHash(nodes, Schema, {
  publisher: 'example.com', packageName: 'my-data', version: '1.0.0',
});

canonicalFormVersion: "1" — the content-address rules are frozen and evolve only by minting a new version (via the underlying canonical-form spec).

Embedded values (0.2.0)

An object property's value is a reference ({ $ref: uri }) or an embedded node: a map with no $id, an optional $name (the authored dict-key — hash-relevant), an optional $type, and schema-mapped fields. An explicit $type emits a type statement inside the embedded (hash-relevant even when it equals the range-derived type); without one, fields are mapped via the containing property's range and no type statement is emitted. Embedded collections are ordered lists — list order is semantic and hashed. An empty list contributes no statement (absent and empty are identical at the canonical layer). Gated by vectors/codec-vectors-embedded.json.

Source & issues: https://github.com/kanonak-protocol/runtime