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

@styled-cva/prettier-plugin

v0.1.0

Published

Prettier plugin for [@styled-cva/react](https://www.npmjs.com/package/@styled-cva/react). Normalizes class-string whitespace inside `tw.tag`…``, `tw(Component)`…``, and `tw.tag.cva({ base, variants })` constructs, and rewrites long inline `tw` tagged temp

Readme

@styled-cva/prettier-plugin

Prettier plugin for @styled-cva/react. Normalizes class-string whitespace inside tw.tag, `tw(Component)`…, and tw.tag.cva({ base, variants }) constructs, and rewrites long inline tw tagged templates into multi-line form when they exceed printWidth.

Part of the styled-cva monorepo.

What it does

  1. Normalizes whitespace. Collapses runs of whitespace inside recognized class strings to a single space.
  2. Rewrites long inline tagged templates to multi-line. When tw.tag\…`(ortw(Component)`…`) would overflow printWidth`, the plugin wraps the class list across multiple indented lines.

For Tailwind-aware class ordering, pair this plugin with prettier-plugin-tailwindcss. Load it after this plugin in your Prettier config.

Targets

  • tw.div`…` / tw.button`…` — any tw.<tag> tagged template
  • tw(Component)`…`tw(Foo) wrapper tagged template
  • tw.div.cva({ base: "…", variants: { … } })base string + each variant option string

className="…" attributes are intentionally not handled — that is prettier-plugin-tailwindcss's job.

Example

Before:

const Button = tw.button`  rounded   bg-blue-500   px-4 py-2 font-bold text-white   hover:bg-blue-600  `;

const Card = tw.div.cva({
  base: "  rounded-lg   bg-white   shadow ",
  variants: {
    $tone: {
      info: "  bg-blue-50   text-blue-900 ",
      danger: "bg-red-50  text-red-900",
    },
  },
});

After (printWidth: 80):

const Button = tw.button`rounded bg-blue-500 px-4 py-2 font-bold text-white hover:bg-blue-600`;

const Card = tw.div.cva({
  base: "rounded-lg bg-white shadow",
  variants: {
    $tone: {
      info: "bg-blue-50 text-blue-900",
      danger: "bg-red-50 text-red-900",
    },
  },
});

Multi-line rewrite (when single-line exceeds printWidth):

const HeroCard = tw.div`
  flex items-center justify-between gap-4 rounded-xl
  border border-slate-200 bg-white p-6 shadow-md
  hover:border-slate-300 hover:shadow-lg
`;

Inner lines are indented by tabWidth (or one tab when useTabs is true) relative to the column where the tag starts; the closing backtick aligns back to that column.

Installation

bun add -D @styled-cva/prettier-plugin

Peer dependencies: prettier (^3). Optional companion: prettier-plugin-tailwindcss.

Configuration

In .prettierrc / prettier.config.js:

{
  "plugins": [
    "@styled-cva/prettier-plugin",
    "prettier-plugin-tailwindcss"
  ]
}

Order matters: load @styled-cva/prettier-plugin before prettier-plugin-tailwindcss so class sorting runs on the normalized, multi-lined output.

This plugin reuses the standard Prettier options (printWidth, tabWidth, useTabs). It introduces no new options.

Caveats

  • Static templates only. Tagged templates that contain ${…} interpolations are skipped.
  • Single-line strings stay strings. cva({ base: "…" }) string literals are only whitespace-normalized — they are not converted to multi-line template literals automatically.
  • Recognition is conservative. A tw identifier must be the root of the tag or .cva() member chain. Renamed or aliased tw imports are not detected.