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

@karmicsoft/lc-patch

v0.1.0

Published

Minimal-diff writer for git-backed YAML records — only the edited lines change. A LightCode brick.

Readme

@karmicsoft/lc-patch

Minimal-diff writer for git-backed YAML records. A LightCode brick.

lc-serialize reads and writes a whole file in its canonical style, which is the right contract for a round-trip and the wrong one for a reviewer who reads contributions as diffs: edit one field and, in about 1.7 % of a real corpus, an unrelated value somewhere else gets re-quoted ('l''opéra' → "l'opéra").

lc-patch keeps every line the edit did not touch, byte for byte — quoting, flow lists, number formatting, comments, CRLF, the leading provenance block — and re-emits only the entries that changed, with lc-serialize's own emitter. It imports lc-serialize; it copies nothing from it.

npm i @karmicsoft/lc-patch      # depends on @karmicsoft/lc-serialize ^0.1.1
import { load } from '@karmicsoft/lc-serialize';
import { patch, patchWith } from '@karmicsoft/lc-patch';

const text = await fs.readFile('fiches/persons/louise-michel.yaml', 'utf8');
const record = load(text);
record.addresses[0].period = 1871;

const out = patch(text, record);          // one line differs from `text`
// or, with the story:
const { text: out2, changed, fallback } = patchWith(text, record);
// changed → ['addresses[0].period'], fallback → false

Contract

  • load(patch(text, edited)) deep-equals edited. Always.
  • An untouched record is written back byte-identical.
  • Only changed, added or removed entries move. Changed entries are re-emitted in lc-serialize style; added keys land at the end of their mapping; removed keys take only their own lines.
  • List items are compared by position. A changed item is re-emitted; a mapping item (- id: …) is patched field by field, so one changed field is one changed line.
  • If the structural reader meets a YAML shape it does not know (flow mappings as documents, complex keys…), the result is lc-serialize's full re-emit — still lossless, only less minimal — and patchWith() reports fallback: true with the reason. The brick is never wrong, only sometimes less minimal.

What the reader understands

Block mappings and block sequences, at any depth; a sequence at its key's own indent or one deeper; inline scalars with continuation lines; block scalars (|, |-, |+, >); flow lists on one line; comments and blank lines (they ride with the entry above them); CRLF files.

Proof

npm test runs the acceptance scenarios agreed with a partner — an untouched record written back byte-identical, one edited field is one changed line, a provenance comment kept, wiki-style [[links]] untouched by an edit elsewhere, every edit lossless — against seven real records whose SHA-256 must match their baseline first, plus nine scenarios of the brick's own. The real records are the partner's content: they live with the lab's suite, never in the npm package; without them the suite skips those scenarios by name.

Scope

One document, one mapping at the root. The brick does not merge concurrent edits, does not validate against a schema (that is lc-schema's job), and does not write files. It answers one question: given this file and this edited object, what is the smallest text that loads to the object?

MIT © 2026 KarmicSoft — lightcodepedia.org