Skip to content

Releases: shellscape/postcss-values-parser

v7.0.0

03 Nov 14:31

Choose a tag to compare

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

v6.0.2

07 Jan 04:52

Choose a tag to compare

Bugfixes

  • fix: support parsing */ expressions without surrounding spaces (#144)
  • fix: Quoted – clone throw an error (#141) (#142 )

Updates

  • docs: fix numeric parse result (#139)

v6.0.0

27 Jul 00:48

Choose a tag to compare

Breaking Changes

  • feat!: update PostCSS, use NodeErrorOptions directly from PostCSS types (#133)

Bugfixes

  • fix: Function with dot inside name (#134)
  • fix: TypeScript types, add validation (#132)

v4.0.0

16 Sep 14:28

Choose a tag to compare

Updates

  • chore!: upgrade is-url-superb to ^4.0.0 (#125)

Breaking Changes

Node v10+ now required

v3.2.0

19 Apr 00:16

Choose a tag to compare

Bugfixes

fix: comma separated funcs with no spaces. fixes #91
fix: wonky function names. fixes #92
fix: numeric parsing (#109)

Features

feat: add hwb, lab, and lch to functions matching isColor (#111) …

Updates

test: add test for #104
test: add tests for #106

v3.0.5

26 Jun 16:05

Choose a tag to compare

Bugfixes

  • fix: add time value units (#87)

v3.0.4

04 May 19:10

Choose a tag to compare

Updates

  • Dependency updates and npm audit update

v3.0.3

26 Mar 21:23

Choose a tag to compare

Bugfixes

  • fix: quater milimeters not detected (#81)

Updates

  • docs: fix comment type (#78)

v3.0.2

13 Mar 01:46

Choose a tag to compare

Bugfixes

  • fix: toString should stringify node (#74)
  • fix: manipulation of node structures, proper stringifying (#73)

v3.0.0

04 Mar 16:12

Choose a tag to compare

Major Version 3

This is a major rewrite from top to bottom and contains many breaking changes. The rewrite leverages PostCSS itself under the hood. That means it uses the same tokenizer and parser, with some modifications. The last major update to PostCSS provided consumers with an outstanding model to inherit and extend from the base classes to create derived parsers. That means we now benefit from the rock-solid tokenizing in PostCSS without having to reinvent the wheel, and without introducing new bugs.

This also allows for use of the base PostCSS Node classes, without redefining or duplicating their functionality. Tasks like walking nodes, or inspecting Node properties you'd expect in PostCSS are now identical.

Breaking Changes

Some Node types have changed. Most notably, all characters which can be considered "punctuation" have been moved into the Punctuation Node. Additionally, decorative property names on Nodes have changed in some instances. The full API documentation has more details.

Old Node Type New Node Type
AtWord AtWord
Colon Punctuation
Comma Punctuation
Comment Comment
Func Func
Numbr Numeric
Operator Operator
Paren Punctuation
Str Quoted
UnicodeRange UnicodeRange
Word Word