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

@pyxy/json-diff-viewer

v1.0.1

Published

Framework-agnostic JSON diff viewer with a typed engine, Web Component, and imperative API

Readme

@pyxy/json-diff-viewer

Framework-agnostic TypeScript library for comparing two JSON documents side by side. Ships a typed diff engine, a <json-diff-viewer> Web Component, and an imperative mount helper — with zero runtime dependencies.

Install

npm install @pyxy/json-diff-viewer

Quick start

Web Component

import '@pyxy/json-diff-viewer';

const viewer = document.querySelector('json-diff-viewer');
viewer?.setData(originalJson, updatedJson);
<json-diff-viewer before-label="before.json" after-label="after.json"></json-diff-viewer>

Imperative API

import { renderJsonDiff } from '@pyxy/json-diff-viewer';

const viewer = renderJsonDiff(document.getElementById('diff')!, {
  before: originalJson,
  after: updatedJson,
  beforeLabel: 'firstInput.json',
  afterLabel: 'secondInput.json',
  sorted: false,
});

Diff engine only

import { diffJson, sortJson } from '@pyxy/json-diff-viewer';

const sorted = sortJson(value);
const result = diffJson(before, after);

Viewer API

| Method | Description | | --- | --- | | setData(before, after) | Replace both documents and recompute | | configure(options) | Update labels, sort mode, and/or data | | nextDifference() | Focus the next change (wraps) | | previousDifference() | Focus the previous change (wraps) |

Events:

  • changefocus — fired when navigation focuses a change; event.detail is the DiffChange

Features

  • Aligned side-by-side rows with line numbers
  • Syntax highlighting for keys, strings, numbers, booleans, and null
  • Added / removed / modified highlighting
  • Previous / next navigation with smooth scroll + focus pulse
  • Toggle recursive alphabetical key sorting (arrays keep order)
  • Changes drawer grouped by Added / Modified / Removed with JSONPath entries
  • Sticky parent context bar while scrolling nested JSON
  • Shadow DOM styles, accessible controls, prefers-reduced-motion support

JSONPath rules

  • Root is $
  • Identifier-like keys use dot notation: $.apps.Babylon
  • Other keys use bracket notation: $["key-with-dashes"]
  • Array entries use indexes: $.items[0]

Scripts

npm run dev      # local demo
npm test         # vitest
npm run build    # ESM + UMD + .d.ts
npm run check    # typecheck + test + build

Package exports

| Field | Path | | --- | --- | | main | dist/json-diff-viewer.umd.cjs | | module | dist/json-diff-viewer.js | | types | dist/index.d.ts |

The published library does not load external fonts or assets. The demo may load Google Fonts optionally; the component falls back to system stacks.

POC app: https://json-diff-by-tipu.netlify.app/