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

yoastjs

v1.0.0

Published

SEO & readability analyzer built on top of Yoast SEO

Readme

yoastjs

Simple SEO & Readability Analysis for JavaScript — powered by Yoast SEO

yoastjs is a lightweight wrapper built on top of Yoast SEO that makes SEO and readability analysis easy to use in Node.js, browsers, ESM, CJS, and TypeScript — without dealing with Yoast’s internal APIs or module compatibility issues.


❗ The Problem with Yoast SEO in Modern JS

The official Yoast SEO (yoastseo) package is CommonJS-only.

This causes multiple issues in modern JavaScript projects:

  • ❌ Does not work cleanly with ES Modules
  • ❌ Difficult to import in TypeScript (NodeNext / ESM)
  • ❌ Breaks in browser environments without heavy polyfills
  • ❌ No default types for seamless TS usage

Using Yoast directly often results in:

  • require is not defined
  • Cannot use import statement outside a module
  • Broken builds in Vite / Next.js / ESBuild

✅ How yoastjs Solves This

yoastjs abstracts all Yoast SEO internals and provides:

  • Dual builds: ESM + CommonJS
  • Browser-compatible bundle
  • Node.js support
  • First-class TypeScript types
  • No need to import Yoast directly
  • Automatic environment resolution via exports

You write modern import syntax, and the correct build is picked automatically.


✨ Features

  • Built on top of Yoast SEO
  • Simple one-function API
  • SEO + Readability analysis
  • Works in Node & Browser
  • Supports ESM, CJS, TypeScript
  • Fully typed results
  • Tree-shakable
  • Zero configuration

📦 Installation

npm install yoastjs

or

pnpm add yoastjs

or

yarn add yoastjs

🚀 Quick Start

ESM / TypeScript

import { analyzeContent } from "yoastjs";

const result = analyzeContent({
  title: "What is SEO?",
  slug: "what-is-seo",
  description: "Learn what SEO is and why it matters",
  content: "SEO stands for Search Engine Optimization...",
  keyphrase: "SEO",
});

console.dir(result);

CommonJS (Node.js)

const { analyzeContent } = require("yoastjs");

const result = analyzeContent({
  content: "SEO stands for Search Engine Optimization...",
  keyphrase: "SEO",
});

console.dir(result);

Browser (Vite / Webpack / ESBuild)

import { analyzeContent } from "yoastjs";

const analysis = analyzeContent({
  content: document.querySelector("#editor").value,
  keyphrase: "javascript seo",
});

console.dir(analysis);

🧠 API

analyzeContent(input)

Runs SEO and readability analysis on the provided content.

interface AnalyzeInput {
  title?: string;
  slug?: string;
  description?: string;
  content?: string;
  keyphrase?: string;
  locale?: string; // default: "en_US"
}

📊 Result Format

{
  seo: AnalyzerResult;
  readability: AnalyzerResult;
}

AnalyzerResult

interface AnalyzerResult {
  score: number;
  rating: "good" | "ok" | "bad" | "feedback" | "error";
  results: AnalysisItem[];
}

🌍 Locale Support

English (en_US) by default.


🛠 Build & Compatibility

This package ships environment-specific builds:

| Environment | Supported | | ----------- | --------- | | Node.js | ✅ | | Browser | ✅ | | ESM | ✅ | | CommonJS | ✅ | | TypeScript | ✅ |

Thanks to conditional exports, bundlers automatically select the correct version.


📁 Package Output

dist/
├── browser/
│   ├── index.js
│   └── index.d.ts
├── node/
│   ├── index.js
│   ├── index.cjs
│   └── index.d.ts

🤝 Why yoastjs?

Because content analysis should be simple, not blocked by legacy module formats.

yoastjs lets you use Yoast’s powerful engine in modern JavaScript without friction.


📝 License

MIT