css-tree
3.2.1 · 5 Mar 2026MIT183.3M / weekRepositoryHomepagenpmAtom feed
Upgrading css-tree From 3.0.1 to 3.2.1
3 releases in betweenevery note read
Release by release
- Fixed
Fixed parsing of nested function in a group in definition syntax
- Fixed
- New
Added
"sideEffects": falseinpackage.json - New
Added
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.) - New
Added support for Functional Notation in definition syntax (for now by wrapping function arguments into an implicit group when necessary, see #292)
- New
Added support for stacked multipliers
{A}?and{A,B}?according to spec in definition syntax parsing
- New
- New
Added support for boolean expression multiplier in syntax definition, i.e.
<boolean-expr[ test ]> - New
Added
source,startOffset,startLine, andstartColumnparameters toOffsetToLocationconstructor, eliminating the need to callsetSource()after creating a newOffsetToLocationinstance - Fixed
Fixed
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
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
Fixed syntax definition parser to allow a token to be followed by a multiplier
- Fixed
Fixed location for
Layernode
- New
9 other lines we could not sort, mostly version bumps
- 3.2.0
getTokenEnd(tokenIndex)– returns the token's end offset by index, complementinggetTokenStart(tokenIndex) - 3.2.0
getTokenType(tokenIndex)– returns the token's type by index - 3.2.0
isBlockOpenerTokenType(tokenType)– returnstruefor<function-token>,<(-token>,<[-token>, and<{-token> - 3.2.0
isBlockCloserTokenType(tokenType)– returnstruefor<)-token>,<]-token>, and<}-token> - 3.2.0
getBlockTokenPairIndex(tokenIndex)– returns the index of the pair token for a block, or-1if no pair exists - 3.2.0
Changed
generate()to not auto insert whitespaces between tokens for raw values - 3.2.0
Bumped
mdn/datato 2.27.1 and various fixes in syntaxes - 3.1.0
Exposed
OffsetToLocationclass in the main entry point, which was previously accessible only viacss-tree/tokenizer - 3.1.0
Bumped
mdn/datato 2.12.2
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.