# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [5.0.0] - 2026-10-13 ### Added - Add `parse` option `stripCommentsInValues`, enabled by default for V4 compatibility, with an opt-out that preserves leading, embedded, and trailing value comments. - Export the `ParseOptions` TypeScript interface. - Add differential tests against published V4, including seeded generated CSS, checksum-pinned public stylesheets, and package bundle checks. - Add isolated depth-2048 parsing checks for every package loader, including source positions and parent descriptors. ### Changed - Replace the parser internals with `postcss` and `postcss-safe-parser`, keeping the css-tools API and AST format, with default-output compatibility verified for the tested corpus. - Make V5 the final css-tools release; recommend migrating directly to PostCSS when possible. - Use clean, lockfile-based installs and validate production dependencies and all package bundles before publishing. ### Fixed - Improve V4 compatibility for value normalization, property hacks, at-rule case handling, BOM positions, error details, and malformed-CSS recovery using PostCSS shims. The known issues below remain. - Preserve V4 parsing and recovery for semicolons following ordinary rules, without spurious missing-brace errors or lost declarations. - Preserve declarations and source positions after V4 whitespace characters such as non-breaking spaces and Unicode line separators. - Eliminate per-error reparsing and repeated whole-tree and source-prefix scans in the compatibility layer. - Preserve full declaration-value spans, including leading and trailing comments, V4 whitespace, and delimiter positions. - Restore V4 property/value boundaries for escaped property-name colons. - Preserve V4 nested-rule classification for custom-property blocks without per-block reparsing. - Restore V4 handling of missing semicolons, extra colons, and empty-property recovery. - Preserve comments in at-rule preludes. - Include trailing whitespace in generic statement at-rule end positions, including bare EOF statements, matching V4. - Preserve V4's generic at-rule classification and output for minified anonymous `@layer` blocks. - Restore EOF at-rule comments, whitespace, source spans, and nested generic statements. - Restore missing-block diagnostics for named/vendor keyframes, vendor documents, and page-margin boxes; bound nested recovery to the failed statement and enclosing body. - Correct declaration-only custom-block and enclosing-node end positions. - Replace recursive compatibility traversal, AST conversion, value normalization, and parent attachment with iterative traversal. - Parse empty `@keyframes` blocks that contain whitespace or comments without spurious missing-brace errors. - Restore V4 recovery from a stray `}` followed by `;` without spurious missing-brace errors. - Restore V4 recovery where PostCSS reads the rest of the input as one node: unclosed parentheses, quotes and `url(` in selectors and values. - Restore V4 block at-rule preludes that continue past a `;` or `}` to the end of the input or to a block in the same parent, such as `@media y{@media x}}` and `@media x}b{}`. - Restore V4 handling of doubled semicolons after statements, `@page` statements, malformed import-like statements such as `@import;;` and `@import{}`, nameless keyframes, and unusual keyframe selectors. - Restore V4 recovery for import-like statements after a selector containing one, as in `b}@import x}{}@import x}{}`, and for block at-rules after a `@layer` statement ending in `}`, as in `@layer x}@media y}`. - Read at-rules whose preludes V4's dedicated parsers reject, such as `@property x{}`, as generic at-rules, matching V4. - Read non-CSS whitespace such as a non-breaking space after an at-keyword as V4 does. - Split selector lists in linear time instead of quadratic time, and parse deeply nested parentheses in selectors without overflowing the call stack. - Bound compatibility-layer searches, recovery re-parsing, and recovered output so the compatibility layer does not take quadratic time or memory on malformed input, such as nested selectorless keyframe blocks, many unterminated or nameless (`@}`) at-rules, repeated or nested failed `@page` blocks, long at-rule preludes, deeply nested blocks containing stray semicolons, long runs of comments or unclosed comments, many properties or escaped semicolons in a nested `@font-face` or `@page`, declarations missing their semicolons, and many recovered declarations or errors. - Avoid call-stack overflows in the compatibility layer on long runs of stray `}` or many recovery errors. - Keep the UMD browser bundle self-contained without external PostCSS globals. ### Security - Require PostCSS 8.5.30 with patched `nanoid` and `source-map-js` dependencies. - Disable input source-map processing, matching V4 and preventing embedded or external source maps from being loaded while parsing CSS. ### Known Issues Core PostCSS takes superlinear time on at-rule headers with many leading comments and on many unclosed `url(` tokens. Separately, upstream `postcss-safe-parser` recovery of long sequences without declaration semicolons can exhaust the stack or, from about 600 KB with Node's default limits, the heap, which aborts the process. These affect strict and silent parsing, are accepted for the final V5 release, and **will not be fixed** in css-tools. To restore V4's recovery, silent mode can parse unclosed-`url(` input up to eight more times, which multiplies its cost. Some malformed CSS still parses differently from V4. For example, after eight re-parses silent mode keeps PostCSS's reading of any further malformed input, and a nested block at-rule without a body keeps PostCSS's structure when V4 reads its prelude past the parent's `}` into a later block, as in `@media y{@media x}b{}}`. See [known issues in V5](../README.md#known-issues-in-v5) for examples and mitigation. ## [4.5.0] - 2026-05-20 ### Added - Add support for CSS Nesting — rules nested inside other rules (#621 by @jogibear9988) - Add support for `@container` container queries with nested rule body - Add support for Page Margin Boxes (`@top-left`, `@bottom-right`, `@left-middle`, etc.) inside `@page` - Add generic at-rule fallback — unknown `@foo { ... }` and `@foo ...;` rules are preserved as `CssGenericAtRuleAST` instead of being dropped - Add support for `@counter-style`, `@font-feature-values`, `@scope`, `@view-transition`, `@position-try` - Export new TypeScript types: `CssGenericAtRuleAST`, `CssPageMarginBoxAST`, `CssPositionTryAST`, `CssScopeAST`, `CssViewTransitionAST`, `CssCounterStyleAST`, `CssFontFeatureValuesAST` ### Fixed - Fix selector parsing for complex nested selectors including `:is()`, `:has()`, `:not()` - Fix `@page` to correctly accept margin-box at-rule children - Fix bracket- and quote-aware position tracking for pseudo-functions ### Changed - Upgrade to TypeScript 6.0.2 - Upgrade to `@rollup/plugin-terser` 1.0.0 - Drop Node 18 from CI (EOL April 2025) — minimum supported runtime is now Node 20 ### Security - Update lodash to 4.18.1 - Update minimatch to 3.1.5 - Update picomatch to 4.0.4 ## [4.4.4] - 2025-07-22 ### Changed - Switch from yarn to npm for package management - Switch from eslint to biome for code formatting and linting - Reformat codebase to comply with biome recommendations - Switch from webpack to rollup for bundling ### Fixed - Fix module exports to ensure proper compatibility with bundlers - Add validation check to prevent future export issues ## [4.4.3] - 2025-05-15 ### Security - Fix polynomial regular expression vulnerability on uncontrolled data - Refactor code to enable GitHub security static analysis ### Performance - Improve parsing performance with minor optimizations - Replace regex patterns with string search (indexOf-based) for better performance ### Added - Add new utility functions with comprehensive unit tests - Add improved formatting for CSS Grid template areas (#283 by @jogibear9988) ### Fixed - Fix TypeScript error with ConstructorParameters in Parcel bundler (#444) ## [4.4.2] - 2025-02-12 ### Fixed - Fix regular expression for parsing quoted values in parentheses ## [4.4.0] - 2024-06-05 ### Added - Add support for CSS `@starting-style` at-rule (#319) ## [4.3.3] - 2024-01-24 ### Changed - Update package export configuration (#271) ## [4.3.2] - 2023-11-28 ### Security - Fix ReDoS vulnerability with crafted CSS strings - CVE-2023-48631 ### Fixed - Fix parsing issues with `:is()` and nested `:nth-child()` selectors (#211) ## [4.3.1] - 2023-03-14 ### Security - Fix ReDoS vulnerability with crafted CSS strings - CVE-2023-26364 ## [4.3.0] - 2023-03-07 ### Changed - Update build toolchain and dependencies - Update package exports configuration and file structure ## [4.2.0] - 2023-02-21 ### Added - Add support for CSS `@container` at-rule - Add support for CSS `@layer` at-rule ## [4.1.0] - 2023-01-25 ### Added - Add support for ES Modules (ESM) ## [4.0.2] - 2023-01-12 ### Fixed - Fix `@import` parsing when URL contains semicolons (#71) - Fix regression in selector parsing for attribute selectors (#77) ## [4.0.1] - 2022-08-03 ### Fixed - Fix `globalThis` configuration for webpack to enable UMD module usage in Node.js environments ## [4.0.0] - 2022-06-09 ### Changed - Fork from original css library to Adobe's `@adobe/css-tools` package - Convert codebase from JavaScript to TypeScript - Improve parsing performance by approximately 25% - Update all dependencies to latest versions - Remove source map support --- ## Legacy Versions (Pre-Adobe Fork) ## [3.0.0] - 2020-07-01 ### Changed - Bump major version due to major dependency updates and Node.js version requirement changes ## [2.2.1] - 2015-06-17 ### Fixed - Fix parsing of escaped quotes in quoted strings ## [2.2.0] - 2015-02-18 ### Added - Add `parsingErrors` property to list errors when parsing with `silent: true` - Accept EOL characters and all whitespace characters in at-rules such as `@media` ## [2.1.0] - 2014-08-05 ### Added - Add `inputSourcemaps` option to disable input source map processing - Add `sourcemap: 'generator'` option to return the `SourceMapGenerator` object - Use `inherits` package for inheritance (fixes browser compatibility issues) ### Changed - Change error message format and add `.reason` property to error objects ## [2.0.0] - 2014-06-18 ### Added - Add non-enumerable parent reference to each AST node - Add support for `@custom-media`, `@host`, and `@font-face` at-rules - Allow commas inside selector functions - Allow empty property values - Add `node.position.content` property - Integrate css-parse and css-stringify libraries - Apply original source maps from source files ### Changed - Change default `options.position` value to `true` - Remove comments from properties and values ### Removed - Drop Component(1) support ### Fixed - Fix assertion errors when selectors are missing ## [1.6.1] - 2014-01-02 ### Fixed - Fix component.json configuration ## [1.6.0] - 2013-12-21 ### Changed - Update dependencies ## [1.5.0] - 2013-12-03 ### Changed - Update dependencies ## [1.1.0] - 2013-04-04 ### Changed - Update dependencies ## [1.0.7] - 2012-11-21 ### Fixed - Fix component.json configuration ## [1.0.4] - 2012-11-15 ### Changed - Update css-stringify dependency ## [1.0.3] - 2012-09-01 ### Added - Add Component support ## [0.0.1] - 2010-01-03 ### Added - Initial release