tailwindcss/packages
Robin Malfait 2fd7c8d967
Show warning when using unsupported bare value data type (#17464)
This PR will show a warning if you are using a bare value data type that
is not supported.

Let's say you want to create a new utility that allows `color` to be a
bare value data type like this:
```css
@utility paint-* {
  paint: --value([color], color);
}
```

This means that this would enable new syntax that we don't support yet.
E.g.: `paint-#0088cc`.

The only supported data types for bare values are:

- `number` — `2.5`
- `integer` — `2`
- `ratio` — `1/2`
- `percentage` — `50%`

All other data types are not supported in this position. This PR will
now show a warning:
~~~
Unsupported bare value data type: "color".
Only valid data types are: "number", "integer", "ratio", "percentage".

```css
--value([color],color)
                ^^^^^
```
~~~
Once we have better sourcemap / location tracking support, this warning
will point to the exact spot, but for now, only a re-print of the AST
can be used.


If you _do_ want to use other data types, then you will have to use
arbitrary value syntax with `[…]` instead.


```css
@utility paint-* {
  paint: --value([color]);
}
```

This will allow for `paint-[#0088cc]` for example.

Note: this is not a behavioral change, we already didn't support other
data types, but we silently ignored them. This means that we have to do
more parsing at runtime when evaluating the utility.

With this change, a warning is shown when registering the `@utility`,
not when using it.
2025-04-04 12:20:46 +00:00
..
@tailwindcss-browser Prepare release v4.1.2 (#17530) 2025-04-03 15:36:42 +00:00
@tailwindcss-cli Prepare release v4.1.2 (#17530) 2025-04-03 15:36:42 +00:00
@tailwindcss-node Prepare release v4.1.2 (#17530) 2025-04-03 15:36:42 +00:00
@tailwindcss-postcss Prepare release v4.1.2 (#17530) 2025-04-03 15:36:42 +00:00
@tailwindcss-standalone Prepare release v4.1.2 (#17530) 2025-04-03 15:36:42 +00:00
@tailwindcss-upgrade Prepare release v4.1.2 (#17530) 2025-04-03 15:36:42 +00:00
@tailwindcss-vite Vite: Don't register the current CSS file as a dependency on itself (#17533) 2025-04-03 18:50:16 +02:00
internal-example-plugin Prefix internal modules with internal-* (#14074) 2024-07-29 10:58:07 -04:00
tailwindcss Show warning when using unsupported bare value data type (#17464) 2025-04-04 12:20:46 +00:00
tsconfig.base.json Improve debug logs (#15303) 2024-12-11 15:27:20 +01:00