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

@lexiprep/core

v0.8.0

Published

Reusable pipeline: ebook (EPUB/PDF) -> clean text -> word tokens -> frequency list. Framework-agnostic, zero server/DB deps.

Readme

@lexiprep/core

npm license

Reusable, framework-agnostic pipeline that turns an EPUB or PDF into a frequency-sorted word list — the language-processing engine behind lexiprep, usable on its own in any Node/TypeScript project. Published on npm as @lexiprep/core.

Pure TypeScript, no server or database dependencies. Runs locally, in a worker, in tests, or (via jszip) potentially in the browser.

Install

pnpm add @lexiprep/core

Usage

import { readFile } from "node:fs/promises";
import { readEpub, analyzeBook } from "@lexiprep/core";

const book = await readEpub(await readFile("book.epub"));

const analysis = analyzeBook(book, {
  excludeStopwords: true,   // drop the/a/on/this...
  from: 0,                  // optional section range (EPUB chapters / PDF pages)
  to: 5,
});

console.log(analysis.metadata.title, analysis.totalTokens);
for (const { word, count } of analysis.frequencies.slice(0, 20)) {
  console.log(count, word);
}

PDFs are a drop-in — readPdf returns the same Book, with each page as a section:

import { readPdf } from "@lexiprep/core";

const pdfBook = await readPdf(await readFile("book.pdf"));

API

A Book is { metadata, sections[] }. A section is one EPUB content document or one PDF page, in reading order — so the section range is a chapter range for EPUB and a page range for PDF.

| Export | Purpose | |---|---| | readEpub(input) | Parse an EPUB (2/3) into a Book — sections are content documents in reading order, with clean text. | | readPdf(input) | Parse a PDF into a Book — one section per page, in page order, with clean text. Runs in Node and the browser. | | analyzeBook(book, options?) | Frequency report over a Book (EPUB or PDF) with section-range (from/to), stopword and min-length filters. | | countWords(text, options?) | Frequency count for a raw string. | | tokenize(text) / normalizeWord(raw) | Locale-agnostic word tokenization (EN now, accents/ES ready). | | htmlToText(html) | Strip XHTML to clean text. | | ENGLISH_STOPWORDS | Default English function-word set. |

Full behavior and design notes: see the lexiprep specs.

CLI

pnpm analyze book.epub --top 30      # or: pnpm analyze book.pdf
# options: --from N --to N --min-length N --keep-stopwords --json

Develop

No Docker, no services — just Node + pnpm:

pnpm install
pnpm test          # vitest
pnpm typecheck
pnpm build         # emits dist/ (tsc)

License

MIT — reusable in any project, open or closed.