Skip to content

v7.0.0

Latest

Choose a tag to compare

@shellscape shellscape released this 03 Nov 14:31

7.0.0

Highlights

  • Major rewrite: parser now builds on css-tree for correctness and performance.
  • Package is pure ESM and uses exports; no CommonJS output.
  • Walker helpers are exposed via registerWalkers() and can enable walk* methods like walkWords.

Breaking changes

  • ESM‑only: require('postcss-values-parser') is no longer supported. Use import.
  • Node.js 20.19+ required (per engines).
  • Walker helpers aren’t attached by default. If you relied on root.walkWords(...) in v6, call registerWalkers(Container) once to add the walk* methods.
  • Internal AST is compatible but not identical (migrated to css-tree under the hood). Class names like Word, Numeric, Func, etc., remain.

Migration

  • Replace CommonJS with ESM imports.

  • Register walker helpers before using any walk* APIs:

    import { parse, Container, registerWalkers } from 'postcss-values-parser';
    registerWalkers(Container);

    const root = parse('var(--foo)');
    root.walkWords((word) => {
    if (word.isVariable) console.log(word.value);
    });

  • Review docs for updated node shapes and stringifier behavior.

Commits since v6.0.2

  • 58c3ac0 feat!: use css-tree, rewrite package for ESM (#149) — Andrew Powell
  • 1d367aa docs: update docs for v7 — shellscape
  • c8b1647 chore: add github workflows — shellscape
  • b19c7eb chore: use nvmrc — shellscape

Merged pull requests

  • #149 use css-tree, rewrite package for ESM — Andrew Powell

Full Changelog: v6.0.2...v7.0.0