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

@stackline/unified-diff

v1.0.5

Published

Filter unified diagnostics to changed Git lines while preserving the unified-diff plugin API

Readme

@stackline/unified-diff

Filter unified diagnostics to changed Git lines while preserving the unified-diff plugin API.

npm version license GitHub repository Docs Reddit community

Documentation | npm | Issues | Repository

Current package version: 1.0.5


Why this package?

A scoped maintenance fork of [email protected] by Titus Wormer (MIT). The unified plugin and API are retained, with @stackline/[email protected] replacing deprecated transitive stream dependencies. Binary and mode-only patches no longer throw when no text hunk is present. Version 1.0.1 also fixes inherited changed-line accounting for replacements and multiple Git hunks. Requires Node.js 18 or newer and Git on PATH.

Install with npm install @stackline/unified-diff; import with import unifiedDiff from "@stackline/unified-diff". UPSTREAM.json identifies the released source and integrity. npm test runs the original Travis/GitHub Actions scenarios and focused regressions. npm run build and npm run lint check JavaScript syntax; npm run test:package tests a fresh packed consumer install.

unified plugin to ignore unrelated messages. Currently works in PRs on Travis and GitHub Actions.

When working with natural language, having tools that check cumbersome tasks can be very useful (think alex or retext plugins). However, natural language isn’t as strict as code. Integrating natural language checking in a CI often doesn’t work well due to false positives. It’s possible to add a long list of exceptions, but this soon becomes unmanageable.

This plugin solves that problem, when in CIs, by ignoring any messages on unchanged lines. When run outside supported CIs this plugin doesn’t do anything.

Compatibility

| Item | Value | | --- | --- | | Package | @stackline/[email protected] | | Supported Node.js | >=18 | | Module entry | index.js (ES modules) | | Runtime dependencies | 2 direct dependencies | | Types | index.d.ts | | External tool | Git available on PATH |

Installation

npm install @stackline/unified-diff

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install @stackline/unified-diff

Usage

Say we have this readme.md. Note the an an.

This is an an example.

Then, someone creates a PR which adds the following diff:

diff --git a/readme.md b/readme.md
index 360b225..5a96b86 100644
--- a/readme.md
+++ b/readme.md
@@ -1 +1,3 @@
 This is an an example.
+
+Some more more text. A error.

We have some natural language checking in lint.js:

import {toVFile} from 'to-vfile'
import {reporter} from 'vfile-reporter'
import {unified} from 'unified'
import unifiedDiff from '@stackline/unified-diff'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
import remarkRetext from 'remark-retext'
import retextEnglish from 'retext-english'
import retextRepeatedWords from 'retext-repeated-words'
import retextIndefiniteArticle from 'retext-indefinite-article'

toVFile.read('readme.md').then((file) => {
  unified()
    .use(remarkParse)
    .use(
      remarkRetext,
      unified()
        .use(retextEnglish)
        .use(retextRepeatedWords)
        .use(retextIndefiniteArticle)
    )
    .use(remarkStringify)
    .use(unifiedDiff)
    .process(file)
    .then((file) => {
      console.error(reporter(file))
      process.exit(file.messages.length > 0 ? 1 : 0)
    })
})

lint.js is hooked up to run on Travis in .travis.yml like so:

# ...
script:
- npm test
- node lint.js
# ...

(or in an equivalent GH Actions workflow file)

When run in CI, we’ll see the following printed on stderr(4). Note that an an on L1 is not included because it’s unrelated to this PR.

readme.md
   3:6-3:15  warning  Expected `more` once, not twice   retext-repeated-words      retext-repeated-words
  3:22-3:23  warning  Use `An` before `error`, not `A`  retext-indefinite-article  retext-indefinite-article

⚠ 2 warnings

As there are messages, the build exits with 1, thus failing CI. The user sees this and amends the PR to the following:

diff --git a/readme.md b/readme.md
index 360b225..5a96b86 100644
--- a/readme.md
+++ b/readme.md
@@ -1 +1,3 @@
 This is an an example.
+
+Some more text. An error.

This time our lint task exits successfully, even though L1 would normally emit an error, but it’s unrelated to the PR.

Security

Filtering diagnostics does not validate the content of a change. The plugin preserves added-line accounting across multiple hunks and skips binary or mode-only changes without text hunks.

API Surface

This package exports a plugin as the default export.

unified().use(diff)

Ignore messages emitted by plugins before diff for lines that did not change.

There are no options. If there’s a TRAVIS_COMMIT_RANGE, GITHUB_BASE_REF and GITHUB_HEAD_REF, or GITHUB_SHA environment variable, then this plugin runs, otherwise it does nothing.

To do
  • [ ] Add support for other CIs (ping if you want to work on this)
  • [ ] Add non-CI support (I’m not yet sure how though)

PRs welcome!

Local Development

Clone the repository and run the following commands from its root:

npm ci
npm run build
npm test
npm run lint

The retained upstream development notes below include historical tooling; the commands above are the maintained package checks.

Contribute

See contributing.md in unifiedjs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

Consumer Smoke Test

npm run test:package packs the library and exercises an isolated consumer using the repository fixture.

Release Checklist

  1. Update the package version, lockfile, generated version fields, and changelog together.
  2. Run the development checks above and audit both npm audit and npm audit --omit=dev.
  3. Use the GitHub publish workflow with its Prod environment to publish the exact CI tarball.
  4. Verify public npm bytes, package identity, provenance, and the immutable GitHub release evidence.

License

MIT. Original copyright notices and upstream attribution are retained.

MIT © Titus Wormer

See NOTICE for retained attribution.

Credits and original authors

Original copyright, license notices and contributor acknowledgements remain part of this distribution. Stackline maintenance does not replace authorship of the original work.

Community and Links

Use this repository's issue tracker for reproducible bugs and feature requests. Join r/Stackline for examples, usage questions and release discussions.