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

@particle-academy/fancy-file-commons

v0.2.0

Published

Shared pure core for the Fancy file-focused packages — editors, viewers, writers, and diff surfaces. Structured diff engine + model, git unified-diff parser, merge resolution, per-line gutter annotations, path helpers, and filename→language resolution. Ze

Readme

Fancy File Commons

@particle-academy/fancy-file-commons — the shared pure core for all of the Fancy file-focused packages: the editors (fancy-code), the viewers (FileViewer and friends), the writers (holy-sheet / dark-slide), and the diff surfaces (fancy-diff).

The rule: anything two file packages would otherwise both implement lives here, once. When an editor needs to know what changed in a document, it uses the same engine the diff viewer renders; when a viewer needs a language for app.tsx, it asks the same map the editor uses.

Zero dependencies. No React, no DOM. Every model is JSON-friendly, deterministic (content-derived ids, no randomness), and safe to hand across an MCP bridge.

Modules (v0.1)

diff — structured diffing

  • EnginecomputeDiff(before, after) → a structured Diff: line-level LCS alignment, adjacent delete+insert runs collapsed into replace hunks, optional intra-line word segments.
  • Unified-diff parserparseUnifiedDiff(text) turns git diff output (multi-file) into the same Diff model, one per file (flagged partial).
  • Source resolutionresolveSource({ before, after } | { unified } | { diff }).
  • Merge resolutionmergeResult(diff, acceptance) folds per-hunk accept/reject decisions into the merged document.
  • Line annotationsannotateLines(before, after) → per-line gutter marks for the after document: added / modified per line, deletedAbove / deletedAtEnd counts, and totals. What an editor gutter or diff rail renders.

path — filename helpers

basename / extname / stem — pure string logic (query/hash-aware, dotfile-aware).

language — filename → editor language

languageFromFilename("app.tsx")"typescript", backed by the suite-wide EXT_LANGUAGE extension map. Unknown → "plaintext".

Install

npm install @particle-academy/fancy-file-commons

Use

import {
  computeDiff,
  annotateLines,
  mergeResult,
  setAllStatus,
  languageFromFilename,
  extname,
} from "@particle-academy/fancy-file-commons";

// Structured diff
const diff = computeDiff("a\nb\nc", "a\nB\nc\nd");

// Editor-gutter model (cheap: skips intra-line segmentation)
const ann = annotateLines("a\nb\nc", "a\nB\nc\nd");
// -> { byLine: { 2: {type:"modified"}, 4: {type:"added"} }, deletedAtEnd: 0, added: 1, modified: 1, removed: 0 }

// Accept everything -> the merged result is the after doc
mergeResult(diff, setAllStatus(diff, "accepted")); // "a\nB\nc\nd"

languageFromFilename("src/App.tsx"); // "typescript"
extname("report.final.XLSX"); // "xlsx"

Consumers

| Package | Uses | |---|---| | @particle-academy/fancy-diff | the whole diff module (re-exported), + the React review UI on top | | @particle-academy/fancy-code | annotateLines for the CodeEditor diff gutter; languageFromFilename for FileViewer |

New shared file functionality (mime maps, file-tree models, artifact naming, …) lands here first, then the surface packages consume it.

Develop

npm install
npm test       # node:test over test/*.test.ts
npm run build  # tsup -> dist (ESM + CJS + types)

License

MIT.