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

tree-sitter-sqlite3

v0.1.0

Published

Tree-sitter grammar for SQLite's SQL dialect plus dot-commands, faithful to upstream parse.y.

Readme

tree-sitter-sqlite3

CI License: CC0-1.0

A tree-sitter grammar for SQLite's SQL dialect plus the sqlite3 CLI dot-commands. Translated from upstream parse.y and tokenize.c — every production, precedence rule, and %fallback mirrored.

Tracks sqlite 3.47.0. Bindings: c, go, node, python, rust, swift.

Validated on every push by seven harnesses totalling ~80 000 SQL inputs — including a differential against libsqlite3 3.47.0 over 38 043 fragments extracted from sqlite's own test/*.test, plus libFuzzer + ASAN. Zero unallowlisted "sqlite-accepts / we-reject" divergences. See Validation.

Coverage

Full DML / DDL / CTEs (incl. recursive) / window functions / compound SELECT / upsert / RETURNING / generated columns / STRICT / WITHOUT ROWID / dot-commands / ATTACH / PRAGMA / VACUUM / REINDEX / ANALYZE / EXPLAIN / SAVEPOINT / transactions. sqlite 3.44+ syntax included (aggregate-arg ORDER BY, RIGHT/FULL JOIN, UPDATE FROM, vector-form SET (a,b)=(...), VACUUM INTO <expr>, NULLS FIRST/LAST, count(DISTINCT)).

Queries: highlights.scm, locals.scm, tags.scm.

Validation

CI runs seven harnesses on every push (~80 000 inputs total):

| harness | inputs | bar | |---|---:|---| | tree-sitter test (hand-written corpus) | 147 | 100 % | | upstream-corpus (sqlite's own test/*.test) | 38 043 | ≥ 99.5 % | | differential vs libsqlite3 3.47.0 | 38 043 | 0 unallowlisted SS-AR | | grammar-coverage (every named node type hit) | 100 types | 100 % | | snapshot regression (byte-exact s-exprs) | 147 | byte-exact | | extras-placement (comments between every adjacent token pair) | 1 220 | 100 % | | roundtrip property (range / leaf-concat / monotonicity) | 147 | 100 % |

Plus libFuzzer + ASAN on the parser .so and a mutation fuzzer against libsqlite3.

An external scanner (src/scanner.c) handles lexer-level strictness (malformed blob/numeric literals, number-fused-to-identifier).

Scope

Syntactic only. Mirrors tokenize.c + parse.y, not the semantic-validation layer that runs during sqlite3_prepare_v2's code-gen. ~78 inputs we accept get rejected by sqlite at runtime (build-flag-dependent productions, parse-time semantic checks); see docs/allowlists.md for the taxonomy. Layer your own semantic checks on top.

Build

Inside the dev container:

docker compose build
docker compose run --rm dev tree-sitter generate
docker compose run --rm dev tree-sitter test

Or with a host [email protected] and parser.c already checked in: tree-sitter test works directly from a fresh clone.

Upstream tracking

Vendored under vendor/ with sha256 pins and an update runbook (vendor/README.md):

  • parse.y — productions, precedence, %fallback.
  • tokenize.c — character classes, literal forms, comments.
  • mkkeywordhash.c — canonical keyword list + masks.
  • shell.c — dot-command list (sourced separately from parse.y).

Update loop: bump vendor → diff parse.y → mirror in grammar.js → add fixtures → tree-sitter generate → commit src/.

Translation notes

  • %fallback: _identifier as choice(identifier, ...keyword_tokens).
  • %wildcard ANY: ambiguity resolved via conflicts.
  • %ifdef SQLITE_OMIT_*: always parse the un-OMIT form.
  • Lemon semantic actions (C blocks): not translated; downstream consumers do semantic validation.

License

CC0-1.0 (mirrors SQLite's public-domain stance). Vendored sqlite sources under vendor/ are themselves public-domain per https://www.sqlite.org/copyright.html.