css-tree
3.2.1 · 5 Mar 2026MIT183.3M / weekRepositoryHomepagenpmAtom feed
Upgrading css-tree From 1.1.3 to 3.2.1
15 releases in betweennotes for 5
- 1+
- change to make
- 0
- advisories fixed
- 34+
- new
- 13+
- fixes
Counted from 5 of 15 release notes. Advisories are counted from the advisory database, in full.
Before you upgrade
Tick each one off as you go- Breaking3.0.1
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
- Breaking
Removed second parameter (
assign) for the callback in thefork()method (e.g.,syntax.fork((config, assign) => { ... })), as it simply refers toObject.assign() - New
Added
errorsarray to theLexer#validate()method result, providing details on problematic syntax. - New
Added a
Lexer#cssWideKeywordsdictionary to list CSS-wide keywords - New
Updated the Lexer's constructor to consider
config.cssWideKeywordsfor overriding the default list - New
Expanded the lexer's dump output to include the
cssWideKeywordsdictionary - New
Modified the
fork()method to accept acssWideKeywordsoption, allowing the addition of new keywords to the existing list - Fixed
Fixes in syntaxes:
<basic-shapes>,<absolute-color-function>and<'stroke-opacity'>
- Breaking
- New
Added support for the
@containerat-rule - New
Added support for the
@starting-styleat-rule - New
Added support for the
@scopeat-rule - New
Added support for the
@position-tryat-rule
- New
2.0.0 – 2.3.110 releases, no release note
26 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 - 3.0.1
Bumped
mdn/datato 2.12.1
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.