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

cssnano-utils

v9.0.0

Published

Utility methods and plugin for cssnano projects

Readme

cssnano-utils

Utility methods and plugins for cssnano projects.

API

PostCSS Utilities

| Utility | Description | | --- | --- | | rawCache | PostCSS plugin that sets default formatting for generated AST nodes on result.root.rawCache. |

CSS Tokenizer and Value Utilities

| Utility | Description | | --- | --- | | TokenType | Re-exported TokenType enum from @csstools/css-tokenizer. | | tokens | Tokenize a CSS string into a CSSToken[] array with trailing EOF tokens stripped. | | tokenStart | Return the inclusive start character offset of a token (token[2]). | | tokenEnd | Return the exclusive end character offset of a token (token[3] + 1) for string slicing. | | decoded | Return the decoded string value of a token, falling back to its raw representation. | | numeric | Parse a single token into { number, unit }, or false if not a numeric token. | | endsWithEscapingBackslash | Whether a string ends in an odd run of backslashes, so the last one escapes whatever follows. | | isHexDigitCode | Whether a UTF-16 code unit is an ASCII hex digit (0-9, a-f, A-F). | | mathFunctions | Read-only Map from each CSS Values 4 math function name to its [min, max] inclusive argument count (max may be Infinity). Iterating yields [name, range] pairs; use .keys() for names. | | balancedTokens | Parse CSS into a BalancedTokens index of matching delimiters ((), [], {}), or undefined if unbalanced. | | applyEdits | Apply validated, non-overlapping string edits. Invalid bounds or overlaps fail closed by returning the complete original source. |

BalancedTokens Methods

Instances returned by balancedTokens(source) provide:

  • endForOpening(index): Returns the closing token index for an opening delimiter token at index.
  • topLevelSegments(startIndex?, endIndex?, delimiter?): Splits a balanced token range by a top-level delimiter (defaults to comma).

Usage

import cssnanoUtils from 'cssnano-utils';

const { tokens, balancedTokens, applyEdits } = cssnanoUtils;

const structure = balancedTokens('cubic-bezier(0.1, 0.7, 1.0, 0.1)');
if (structure) {
  const segments = structure.topLevelSegments();
  // Process balanced segments
}

Contributors

See CONTRIBUTORS.md.

License

MIT