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

@tabularis/explain

v0.1.0

Published

Parse, analyse and visualise a database EXPLAIN plan. Takes raw EXPLAIN output; never runs a query.

Readme

@tabularis/explain

Analyse and visualise a database EXPLAIN plan.

Takes a plan that has already been produced and derives everything from it: per-node exclusive metrics, diagnostics, statistics, and React views. It never connects to a database, builds an EXPLAIN statement, or runs a query.

Entry points

| Import | Contains | Runtime deps | |---|---|---| | @tabularis/explain | plan types, metrics, diagnostics, stats, formatters, tree helpers | none | | @tabularis/explain/react | the views: graph, table, diagram, stats, node details, bars | react, react-i18next, @xyflow/react, dagre, clsx, lucide-react | | @tabularis/explain/flow | ReactFlow node/edge adapter + dagre layout | @xyflow/react, dagre |

The core entry point has no runtime dependencies at all, so plan analysis can run anywhere — a browser, a worker, a Node script, a test.

import {
  computeExplainMetrics,
  getPlanDiagnostics,
  getExplainPlanSummary,
} from "@tabularis/explain";

const metrics = computeExplainMetrics(plan);
const diagnostics = getPlanDiagnostics(plan, metrics);
const summary = getExplainPlanSummary(plan, metrics);
import { ExplainGraph, ExplainTableView } from "@tabularis/explain/react";

<ExplainGraph
  plan={plan}
  metrics={metrics}
  diagnostics={diagnostics}
  selectedNodeId={selectedNodeId}
  onSelectNode={setSelectedNodeId}
/>;

Where a plan comes from

This package never runs a query — it turns already-produced EXPLAIN output into an ExplainPlan and analyses it. The parsers cover Postgres EXPLAIN (FORMAT JSON) and text output, MySQL/MariaDB FORMAT=JSON, EXPLAIN ANALYZE / ANALYZE FORMAT=TEXT trees and decoded tabular rows, and SQLite EXPLAIN QUERY PLAN rows:

import { parseExplain, parseExplainFor, parseRawExplain } from "@tabularis/explain";

// Sniff the format of a pasted blob or an uploaded file:
const plan = parseExplain(raw);

// Or name the engine when the caller knows it:
const hinted = parseExplainFor(raw, "mysql");

// Or parse the raw payload a host driver handed over:
const fromDriver = parseRawExplain({ engine, format, payload, original_query });

A host obtains the bytes however it likes — a driver, a pasted textarea, an uploaded file — and hands them over untouched. Drivers for engines these parsers do not know (plugin drivers) supply a fully-parsed ExplainPlan instead; both shapes flow through resolveExplainOutput.

Host requirements for the React entry point

The views are presentational but not self-contained. A host must provide:

  • Tailwind, with the same colour tokens the desktop app uses — components emit utility class names rather than scoped CSS;
  • an initialised react-i18next instance exposing the editor.visualExplain.* key namespace. The keys deliberately stay with the host's translation catalogue rather than being bundled here;
  • @xyflow/react's stylesheet, if ExplainGraph is used.

Deliberately not included

  • Running EXPLAIN, or deciding whether a statement can be explained (isExplainableQuery / isDataModifyingQuery are host SQL concerns).
  • Any Tauri, IPC or transport call.
  • The AI plan explanation, which is a host feature backed by a host-configured provider.
  • The raw-output tab, which the desktop app renders with Monaco and its own theme system.

The last two are why the desktop app keeps its own VisualExplainView composition: it wires those host pieces around the components exported here.

Development

pnpm --filter @tabularis/explain typecheck
pnpm --filter @tabularis/explain build     # tsup → dist, for publishing
pnpm vitest run packages/explain           # tests run from the repo root

Workspace consumers resolve the entry points straight to TypeScript source, so no build step is needed during development; publishConfig swaps in dist when the package is published.