1350 Commits
Author SHA1 Message Date
Andrey Sitnik ac033c8e47 Release 8.5.25 version 2026-07-29 12:58:38 +00:00
Andrey Sitnik f121ccda0f Fix 8.5.17 visitor regression 2026-07-29 12:56:11 +00:00
87b9ce6de2 fix: return empty array for empty string in list.split (#2121)
Co-authored-by: ferkans-amir <[email protected]>
2026-07-29 10:23:59 +02:00
Andrey Sitnik 5dca3b52fd Release 8.5.24 version 2026-07-28 11:40:36 +02:00
Haïm DimerandGitHub 05a93532d1 Preserve the BOM when stringifying (#2119)
PostCSS aims for byte-to-byte equal output, but the stringifier dropped a
leading byte order mark: `parse('a{}').toString()` returned `a{}`. The
BOM is already detected (`Input#hasBOM`) but was never re-emitted, so the
`bom.css` round-trip test had to be skipped.

Emit the BOM in `Stringifier#root` when the source had one, and re-enable the
previously skipped test.
2026-07-28 11:38:17 +02:00
Andrey Sitnik f812274a95 Release 8.5.23 version 2026-07-24 17:03:51 +00:00
Andrey Sitnik 2a1afe6782 Does no load source map file without opts.from 2026-07-24 16:59:19 +00:00
Andrey Sitnik 5d8b2fb798 Release 8.5.22 version 2026-07-22 08:47:41 +00:00
Sarath FrancisandGitHub 2b6d01d957 Fix custom property losing its semicolon before a comment (#2117)
A custom property declaration that is the last non-comment child but is
followed by comment siblings was stringified without its terminating
semicolon. Unlike a normal declaration, a custom property keeps everything
up to the next `;` or `}` as its value, so on re-parse the trailing
comments were folded into the value and the comment nodes disappeared.

Building such a tree with append()/insertAfter()/after() therefore
silently dropped the comments. Emit the semicolon when a custom property
still has following siblings so the output round-trips, mirroring the
existing handling for childless at-rules.
2026-07-22 09:41:08 +02:00
Andrey Sitnik 808e14eb90 Release 8.5.21 version 2026-07-21 08:56:53 +00:00
Sarath FrancisandGitHub cdc8897519 Fix childless at-rule losing its semicolon before a comment (#2115)
A childless (statement) at-rule that is the last non-comment child but is
followed by comment siblings was stringified without its terminating
semicolon. On re-parse the trailing comments were folded into the
at-rule prelude and dropped, so building such a tree with append() or
insertBefore() silently lost the comment nodes.

Emit the semicolon when a childless at-rule still has following siblings
so the output round-trips.
2026-07-21 10:53:42 +02:00
Ian KerinsandGitHub 633451b0da Fix mismatched JSDoc comments on Position (#2114)
Also, clarify that `column` is 1-based, like `line`.
2026-07-21 10:52:01 +02:00
Andrey Sitnik c0abed1865 Release 8.5.20 version 2026-07-19 08:44:02 +00:00
Sarath FrancisandGitHub 680ebe0244 Fix missing space when AtRule#params is set after parsing (#2113) 2026-07-19 10:23:15 +02:00
Mahin AnowarandGitHub 96354b9667 Rebuild nodes from another PostCSS copy in Warning (#2112) 2026-07-15 19:24:51 +02:00
Andrey Sitnik 51fff91423 Release 8.5.19 version 2026-07-13 10:41:10 +00:00
Mahin AnowarandGitHub 8faa4f8eee Keep explicitly set raws.before when inserting nodes into root (#2111) 2026-07-13 12:37:33 +02:00
Andrey Sitnik 9e8657790d Release 8.5.18 version 2026-07-12 20:34:36 +00:00
Andrey Sitnik c5fff770ca Limit where source map can be loaded for security reasons 2026-07-12 20:31:03 +00:00
Andrey Sitnik d973e5ab73 Release 8.5.17 version 2026-07-11 19:17:11 +00:00
Andrey Sitnik 69d5b399fd Fix Maximum call stack size exceeded error 2026-07-11 19:06:38 +00:00
Andrey Sitnik 62ad57f190 Prevent prototype hijacking in fromJSON 2026-07-11 16:44:46 +00:00
Alexander KireyevandGitHub 64117f22bc Fix Input#origin() mixing null and undefined for unmapped end position (#2106)
When the requested end position has no mapping in the source map,
originalPositionFor() returns an object with line/column set to null
rather than omitting them. endLine picked that null up correctly, but
endColumn was computed as `to && to.column + 1`, which due to operator
precedence is `to && (to.column + 1)`, turning null into 1. So callers
could get back { endColumn: 1, endLine: null }, which doesn't match
how every other unmapped case in this function behaves (undefined for
both). Looks like the +1 fix in #2036 covered the mapped case but not
this one.

Guard `to` the same way `from` already is, so an unmapped end position
just stays undefined.
2026-06-30 23:14:26 +02:00
Andrey Sitnik 3227002b68 Release 8.5.16 version 2026-06-28 14:56:11 +00:00
Andrey Sitnik fb2bc3f358 Update formatting 2026-06-28 14:54:32 +00:00
mizdraandGitHub aef1148997 Fix Input#origin() returning incorrect position (#2036)
* Add missing `test.run()`

* Fix `Input#origin()` returning incorrect position

* Refactor test with source-map-js
2026-06-28 16:53:40 +02:00
Mahin AnowarandGitHub 9e1092edf0 Don't clone root-less child nodes in container constructor (#2097)
The container constructor cloned every real Node passed in `nodes`, so a
freshly created (parent-less) node was adopted as a copy and the caller's
original reference never had its `parent` set — later operating on it threw
`Cannot read properties of undefined`. The clone was added only to keep the
source tree intact when moving nodes between roots, so it's skipped when the
node has no parent. Nodes that already belong to another tree are still
cloned, preserving the existing behavior. Closes #1987.
2026-06-28 16:50:07 +02:00
Sarath FrancisandGitHub be16af8528 Preserve node raws when rehydrating a JSON AST (#2100)
fromJSON() attached child nodes through the container constructor, which
runs them back through append()/normalize(). For root-level children that
re-applies insertion spacing normalization and overwrites each node's own
raws.before with the previous sibling's, so toJSON() -> fromJSON() was not
lossless: stylesheets with non-uniform blank lines between top-level rules
came back with their spacing flattened.

Rehydrate children separately and attach them directly, keeping the raws
exactly as serialized.
2026-06-28 12:56:11 +02:00
Sarath FrancisandGitHub aeeb3006c0 Fix Node#rangeBy() ignoring index 0 (#2091)
When calling Node#rangeBy() (and therefore Node#error() and
Node#warn()) with index 0, the resulting range covered the whole node
instead of a single character at offset 0.

The end-of-range branch used a truthy check on opts.index, so an index
of 0 fell through and left the end position at the node's end. This is
the same off-by-zero issue that was previously fixed for endIndex; the
index branches were missed. Switch both index checks to a numeric type
check, matching the existing endIndex handling.

index 0 now produces a single-character range, consistent with every
other index value.
2026-06-27 15:48:04 +02:00
74d18036e9 fix(node): always include offset in positionBy() like rangeBy() (#2099)
positionBy()'s default branch returned this.source.start verbatim, so for
custom syntaxes whose source.start lacks an offset (e.g. postcss-html) it
returned a position without offset, violating the Position type which
declares offset as required. rangeBy()/positionInside() were normalized to
always compute offset via sourceOffset() (#2033, issue #2029) but
positionBy() was left behind. Mirror the rangeBy() pattern.

Co-authored-by: oss69U-prep <prep@local>

Co-authored-by: Hanzo Dev <[email protected]>
2026-06-27 15:31:28 +02:00
Andrey Sitnik 3a0ceaf41e Release 8.5.15 version 2026-05-19 09:50:43 +00:00
Andrey Sitnik 123d45b9eb Speed up declaration parsing by avoiding creating new array on each token 2026-05-19 09:36:14 +00:00
Andrey Sitnik 1a2b91cbba Fix code format 2026-05-19 09:05:25 +00:00
Andrey Sitnik d2aca9c7c7 Release 8.5.14 version 2026-05-04 16:41:38 +00:00
James Garbutt e712faf51f fix: always call raw to retrieve raw values
Without this, it becomes impossible to override the stringifier with
your own raw computation, etc.
2026-05-04 12:37:08 +01:00
Andrey Sitnik d45cac6819 Release 8.5.13 version 2026-04-30 20:18:02 +00:00
Andrey Sitnik ee5ea010bc Update dependencies 2026-04-30 20:16:14 +00:00
Andrey Sitnik b2c52e2a9a Revert stringifier changes because of the conflict with postcss-scss 2026-04-30 20:14:57 +00:00
Andrey Sitnik a8d0d60fc3 Release 8.5.12 version 2026-04-26 14:22:40 +00:00
Andrey Sitnik 5dec78da8c Another try to fix coverage 2026-04-26 14:17:46 +00:00
Andrey Sitnik 3e3cbd5378 Try to fix coverage 2026-04-26 14:15:20 +00:00
Andrey Sitnik d99a1fed74 Load only .map source maps 2026-04-26 13:44:05 +00:00
Andrey Sitnik 9d9bd9ab5f Avoid throwing JSON parsing errors for non-JSON source maps 2026-04-26 13:09:20 +00:00
Andrey Sitnik 1499b031dc Release 8.5.11 version 2026-04-26 12:55:32 +00:00
Andrey Sitnik 94190f83cb Speed up parsing many nested brackets 2026-04-26 12:53:38 +00:00
Alan ZabihiandAndrey Sitnik 08acc2128f Cache node.raws locally in Stringifier hot methods
Cache node.raws references locally in hot methods (atrule, block, body,
comment, decl) to avoid repeated property chain resolution. In decl(),
inline the common rawValue() path when node.raws.value exists. In raw(),
cache root.rawCache in a local variable. In body(), short-circuit
raw(child, 'before') when child.raws.before is already defined. In
block() and comment(), inline the raws check to skip raw() call overhead
when the value is already present.
2026-04-16 15:44:46 +02:00
Alan ZabihiandAndrey Sitnik 1ccf6b584b Bypass MapGenerator for no-source-map stringify in LazyResult
When opts.map is undefined and the root has no previous source map,
skip MapGenerator construction entirely and stringify directly. This
avoids 3 Map allocations, a clearAnnotation AST walk, and a previous()
AST walk per file.
2026-04-16 15:41:45 +02:00
Andrey Sitnik a218f7d72a Release 8.5.10 version 2026-04-15 16:41:26 +02:00
Andrey SitnikandGitHub 675d4292f7 Escape </style> in CSS output (#2074) 2026-04-15 16:38:35 +02:00
Andrey Sitnik 2ff817860b Release 8.5.9 version 2026-04-07 22:20:40 +00:00