Commit Graph
4288 Commits
Author SHA1 Message Date
Andrey Sitnik 95e18706ed Update dependencies 2026-07-28 11:39:19 +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 9f5b165d74 Fix types check 2026-07-24 17:05:04 +00:00
Andrey Sitnik f812274a95 Release 8.5.23 version 8.5.23 2026-07-24 17:03:51 +00:00
Andrey Sitnik 74fc4a5f42 Update dependencies 2026-07-24 17:02:38 +00:00
Andrey Sitnik 2a1afe6782 Does no load source map file without opts.from 2026-07-24 16:59:19 +00:00
Andrey Sitnik 34dc0fd278 Typo 2026-07-22 19:13:50 +00:00
Andrey Sitnik 94d0f84ec1 Update EM banner 2026-07-22 19:13:05 +00:00
Andrey Sitnik ca63c125a5 Update EM banner 2026-07-22 19:12:27 +00:00
Andrey Sitnik 5d8b2fb798 Release 8.5.22 version 8.5.22 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 8.5.21 2026-07-21 08:56:53 +00:00
Andrey Sitnik e741d2e9c1 Update dependencies 2026-07-21 08:55:33 +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 8.5.20 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
Andrey Sitnik 8b102a2574 Update dependencies 2026-07-16 09:01:57 +00:00
Andrey Sitnik b59dba23aa Move back to latest 11 pnpm 2026-07-16 09:00:42 +00:00
Andrey Sitnik 4f80bb3548 Update pnpm to check that CI is fixed 2026-07-16 08:59:22 +00:00
Mahin AnowarandGitHub 96354b9667 Rebuild nodes from another PostCSS copy in Warning (#2112) 2026-07-15 19:24:51 +02:00
Andrey Sitnik 61756ca2a0 Improve CI security 2026-07-15 16:35:41 +00:00
Andrey Sitnik 9e19e4adf0 Remove patch after updating dependency 2026-07-14 15:48:10 +00:00
Andrey Sitnik 51fff91423 Release 8.5.19 version 8.5.19 2026-07-13 10:41:10 +00:00
Andrey Sitnik 813f8260f1 Fix CI on Windows too 2026-07-13 10:39:22 +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 5bcac3af0e Temporary fix CI 2026-07-13 10:36:59 +00:00
Andrey Sitnik 9e8657790d Release 8.5.18 version 8.5.18 2026-07-12 20:34:36 +00:00
Andrey Sitnik 201799774a Update dependencies 2026-07-12 20:31:53 +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 8.5.17 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 c05932eede Fix linter 2026-07-11 17:47:41 +00:00
Andrey Sitnik 3c60e5b691 Fix CI 2026-07-11 16:46:55 +00:00
Andrey Sitnik 62ad57f190 Prevent prototype hijacking in fromJSON 2026-07-11 16:44:46 +00:00
Andrey Sitnik 617c506988 Update dependencies 2026-07-11 16:42:10 +00:00
Masafumi KobaandGitHub eb5481f703 Fix non-closed <div align="center"> in README (#2110)
Fixes the problem that all elements after `<div align="center">` are centered in `README.md`.
2026-07-08 17:00:59 +02:00
Andrey Sitnik f4c637635c Remove old sponsors 2026-07-07 22:13:14 +00:00
777b574698 docs: fix invalid JS in writing-a-plugin examples (#2107)
Co-authored-by: Lenox Fernando <[email protected]>
2026-07-03 08:00:46 +02: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 8.5.16 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
Andrey Sitnik 88a1b66752 Fix tests 2026-06-28 14:50:44 +00: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
Andrey Sitnik 8a1ee6f8db Revert version update to fix old Node.js on CI 2026-06-28 14:44:07 +00:00
Andrey Sitnik 62c015dfa8 Update dependencies 2026-06-28 14:38:59 +00: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
Andrey Sitnik 40906f1ae5 Fix Node.js 26 tests 2026-06-27 13:36:30 +00:00