tailwindcss/packages
Ridwan Olanrewaju 16e94cbf7f
Make createCompatConfig theme mappings safe to spread when a namespace returns a string (#20399)
When building the legacy config compat layer, namespace mappings like
`fontSize` → `text`, `boxShadow` → `shadow`, `animation` → `animate`,
etc. spread the result of `theme(namespace, {})` directly:

```ts
...(theme('text', {}) ?? {})
```

Some of these namespaces can return a **string** (e.g. `theme('text',
{})` → `'1rem'`). Spreading a string produces char-indexed keys (`{ '0':
'1', '1': 'r', ... }`) instead of a `{ DEFAULT: ... }` entry, silently
corrupting the compat config output.

This PR adds a small `spreadTheme` helper that normalizes the return
value before spreading:

- `string` → `{ DEFAULT: value }`
- plain object → `{ ...value }`
- anything else → `{}`

and updates all namespace mappings to use it. Includes unit tests for
the helper plus integration tests for the affected namespaces and the
string-return regression cases.

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2026-08-10 15:22:33 +00:00
..
@tailwindcss-browser Bump dependencies (#20381) 2026-08-04 13:55:03 +02:00
@tailwindcss-cli Bump dependencies (#20381) 2026-08-04 13:55:03 +02:00
@tailwindcss-node Bump dependencies (#20381) 2026-08-04 13:55:03 +02:00
@tailwindcss-postcss Bump dependencies (#20381) 2026-08-04 13:55:03 +02:00
@tailwindcss-standalone Bump dependencies (#20381) 2026-08-04 13:55:03 +02:00
@tailwindcss-turbopack Add Turbopack loader integration coverage 2026-07-31 15:13:38 +02:00
@tailwindcss-upgrade Bump dependencies (#20381) 2026-08-04 13:55:03 +02:00
@tailwindcss-vite Prevent @tailwindcss/vite crash under Vite's experimental bundledDev (#20379) 2026-08-03 15:10:06 +02:00
@tailwindcss-webpack 4.3.3 (#20334) 2026-07-16 07:21:50 -04:00
internal-example-plugin Prefix internal modules with internal-* (#14074) 2024-07-29 10:58:07 -04:00
tailwindcss Make createCompatConfig theme mappings safe to spread when a namespace returns a string (#20399) 2026-08-10 15:22:33 +00:00
tsconfig.base.json Improve debug logs (#15303) 2024-12-11 15:27:20 +01:00