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

@reyalp/preshape

v0.0.3

Published

struct/model defs & generator

Readme

Preshape

Typescript & PostgreSQL code generator


It generates typedefs/enums/serdes/pg-migrations from DSL, see sample/*.txt, sample/*.yml.

run them with:

pnpm run test:do:draft -- -f <input-file>

output files are in test/src/*.ts, test/data/*/*.sql.

Types

| DSL notation | means | map to typescript | map to pgsql | | --- | --- | --- | --- | | bool | boolean | boolean | int2 | | i32 | signed 32-bits integer | number | int4 | | u8 | unsigned 8-bits integer | number | uint2 | | i4 | unsigned 4-bits integer | number | int2 | | i64 | unsigned 64-bits integer | bigint | int8 | | i53 | unsigned 53-bits integersafe integer | number | int8 | | str | str(at most 232-1 octets) | number | int2 | | str/16 | str(at most 16 octets) | string | text | | str/i8 | str(at most 28-1 octets) | string | text | | str/u8 | str(at most 28-1 octets)i/u are the same | string | text | | bytea | bolb(at most <= 232-1 bytes) | Buffer | bytea | | ?i32 | i32 or nothing | number &vert; undefined | int4NULLABLE | | [i32] | i32 array(at most 232-1 elements) | number[] | jsonbTODO: maybe array? | | [i32; 4] | i32 array(at most 4 elements) | number[] | jsonb | | [i32; i8] | i32 array(at most 28-1 elements) | number[] | jsonb | | [?i32] | optional i32 array | (number &vert; undefined)[] | jsonb | | [str/4; 4] | string array(at most 4 elements)(each contains at most 4 octets) | string[] | jsonb | | (i4; i8; str) | tuple | [number, number, string] | jsonb | | (label: i4; i8; str) | tuple, labelled | [labal: number, number, string] | jsonb | | [(i8, i8)] | array of tuple | [number, number][] | jsonb | | [(i8, [i8])] | array of tuple.. mixed | [number, number[]][] | jsonb | |{  id i32  name str} | a struct/object | { id: number; name: string } | jsonb| |{  ...  t case {    'u1' { arg1 str }    'u2' { arg2 i32 }  }} | tagged union | { ... } & ({ t: 'u1'; arg1: string } | { t: 'u2'; arg2: number}) | jsonb|

TODO Cont'd