css-tree
3.2.1 · 5 Mar 2026MIT183.3M / weekRepositoryHomepagenpmAtom feed
Where each line stands
Plan an upgradeLatest releases
All 21 releases- 3.x · latest line
3.2.1
5 Mar 2026Fixed parsing of nested function in a group in definition syntax
3.2.0
5 Mar 2026Added
"sideEffects": falseinpackage.jsonAdded
listoption to theparse()method to specify whether the parser should produce aList(by default,list: true) or an array (list: false) for node's children (e.g.,SelectorList,Block, etc.)Added support for Functional Notation in definition syntax (for now by wrapping function arguments into an implicit group when necessary, see #292)
Added
"sideEffects": falseinpackage.jsonAdded
listoption to theparse()method to specify whether the parser should produce aList(by default,list: true) or an array (list: false) for node's children (e.g.,SelectorList,Block, etc.)Added support for Functional Notation in definition syntax (for now by wrapping function arguments into an implicit group when necessary, see #292)
Added support for stacked multipliers
{A}?and{A,B}?according to spec in definition syntax parsingAdded math functions support in syntax matching (e.g.,
min(),max(), etc.)Added
onTokenoption to theparse()method, which can be either an array or a function:When the value is an array, it is populated with objects
{ type, start, end }(token type, and its start and end offsets).When the value is a function, it accepts
type,start,end, andindexparameters, and is invoked with a token API asthis, enabling advanced token handling (see onToken). For example, the following demonstrates checking if all block tokens have matching pairs:parse(css, { onToken(type, start, end, index) { if (this.isBlockOpenerTokenType(type)) { if (this.getBlockPairTokenIndex(index) === -1) { console.warn('No closing pair for', this.getTokenValue(index), this.getRangeLocation(start, end)); } } else if (this.isBlockCloserTokenType(type)) { if (this.getBlockPairTokenIndex(index) === -1) { console.warn('No opening pair for', this.getTokenValue(index), this.getRangeLocation(start, end)); } } } });
Extended
TokenStreamwith the following methods:getTokenEnd(tokenIndex)– returns the token's end offset by index, complementinggetTokenStart(tokenIndex)getTokenType(tokenIndex)– returns the token's type by indexisBlockOpenerTokenType(tokenType)– returnstruefor<function-token>,<(-token>,<[-token>, and<{-token>isBlockCloserTokenType(tokenType)– returnstruefor<)-token>,<]-token>, and<}-token>getBlockTokenPairIndex(tokenIndex)– returns the index of the pair token for a block, or-1if no pair exists
Changed
generate()to not auto insert whitespaces between tokens for raw valuesFixed
fork()to extendnodedefinitions instead of overriding them. For example,fork({ node: { Dimension: { generate() { /* ... */ } } } })will now update only thegenerate()method on theDimensionnode, while inheriting all other properties from the previous syntax definition.Bumped
mdn/datato 2.27.1 and various fixes in syntaxes
3.1.0
6 Dec 2024Added support for boolean expression multiplier in syntax definition, i.e.
<boolean-expr[ test ]>Added
source,startOffset,startLine, andstartColumnparameters toOffsetToLocationconstructor, eliminating the need to callsetSource()after creating a newOffsetToLocationinstanceExposed
OffsetToLocationclass in the main entry point, which was previously accessible only viacss-tree/tokenizer
Added support for boolean expression multiplier in syntax definition, i.e.
<boolean-expr[ test ]>Added
source,startOffset,startLine, andstartColumnparameters toOffsetToLocationconstructor, eliminating the need to callsetSource()after creating a newOffsetToLocationinstanceExposed
OffsetToLocationclass in the main entry point, which was previously accessible only viacss-tree/tokenizerFixed
Rawnode value consumption by ignoring stop tokens inside blocks, resolving an issue whereRawvalue consumption stopped prematurely. This fix also enables parsing of functions whose content includes stop characters (e.g., semicolons and curly braces) within declaration values, aligning with the latest draft of CSS Values and Units L5.Fixed
TokenStream#balancecomputation to handle unmatched brackets correctly. Previously, when encountering a closing bracket, theTokenStreamwould prioritize it over unmatched opening brackets, leading to improper parsing. For example, the parser would incorrectly consume the declaration value of.a { prop: ([{); }as([{)instead of consuming it until all opened brackets were closed (([{); }). Now, unmatched closing brackets are discarded unless they match the most recent opening bracket on the stack. This change aligns CSSTree with CSS specifications and browser behavior.Fixed syntax definition parser to allow a token to be followed by a multiplier
Fixed location for
LayernodeBumped
mdn/datato 2.12.2
Dependency tracking
Know when your own dependencies move
This page watches css-tree. inlinr reads your package.json and keeps the same watch on every dependency you declare, then tells you only what needs you.
Advisories reach you
An email when a critical or high advisory affects a project, before the next install.
Upgrades checked first
Peer ranges, Node, ESM-only and types changes read before you bump.
Only what matters
Majors and breaking notes stay; patches and sibling bumps fold into one line.
Registry facts last checked 22 Nov 2026. Releases and advisories last read 22 Nov 2026.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.