tailwindcss/packages
Robin Malfait 1ca0aacdae
Add source map visualization for tests (#19997)
This PR is an internal change only related to how we visualize source
maps.

As part of this PR
(https://github.com/tailwindlabs/tailwindcss/pull/19996) I added a test
for source maps related to how `@variant` is processed. And while the
result was correct, I had a hard time verifying if this was _actually_
correct. I did the mental mapping of comparing locations from the output
to the input.
<img width="495" height="495" alt="image"
src="https://github.com/user-attachments/assets/2b1c12cd-43ee-461a-b93b-bafe6ce1cce5"
/>

With this PR, I want to make that more visual by actually printing the
input source(s) and output file and highlight the necessary parts:
<img width="1101" height="1085" alt="image"
src="https://github.com/user-attachments/assets/14390026-f211-4cfc-8c6c-3293105f6403"
/>

I didn't want to get too clever here. But printing line numbers also
helps in case we point to different spots on the same line:
<img width="1200" height="981" alt="image"
src="https://github.com/user-attachments/assets/e75f7622-eb51-49ee-928e-fdc8672d2c3f"
/>

And if we point to different files, then we visualize these as well:
<img width="851" height="957" alt="image"
src="https://github.com/user-attachments/assets/77e65801-b46b-4579-8659-d919a8750f60"
/>


If you combine this with snapshot tests, then it's very easy to verify
that locations match up correctly. Each source map location is
highlighted and references a symbol starting at `A`, `B`, etc.

A change to the source maps _can_ result in a big diff, and even this PR
introduces a big diff because of the preflight diffs. But at least you
can see how things line up.

## Test plan

1. All tests still pass
2. Added tests for the source map visualizer that is only used in tests
3. No actual source code was touched
2026-04-30 14:52:09 +02:00
..
@tailwindcss-browser Bump dependencies (#19957) 2026-04-24 21:21:12 +02:00
@tailwindcss-cli Bump dependencies (#19957) 2026-04-24 21:21:12 +02:00
@tailwindcss-node Bump dependencies (#19957) 2026-04-24 21:21:12 +02:00
@tailwindcss-postcss docs: fix various typos in comments and documentation (#19878) 2026-04-29 13:28:39 +00:00
@tailwindcss-standalone Bump dependencies (#19957) 2026-04-24 21:21:12 +02:00
@tailwindcss-upgrade [@tailwindcss/upgrade] Don’t migrate inline style properties (#19918) 2026-04-29 13:18:02 +00:00
@tailwindcss-vite docs: fix various typos in comments and documentation (#19878) 2026-04-29 13:28:39 +00:00
@tailwindcss-webpack Bump dependencies (#19957) 2026-04-24 21:21:12 +02:00
internal-example-plugin Prefix internal modules with internal-* (#14074) 2024-07-29 10:58:07 -04:00
tailwindcss Add source map visualization for tests (#19997) 2026-04-30 14:52:09 +02:00
tsconfig.base.json Improve debug logs (#15303) 2024-12-11 15:27:20 +01:00