tailwindcss/packages
Robin Malfait 4079059420
Add missing layer(…) to imports above Tailwind directives (#14982)
This PR fixes an issue where imports above Tailwind directives didn't
get a `layer(…)` argument.

Given this CSS:
```css
@import "./typography.css";
@tailwind base;
@tailwind components;
@tailwind utilities;
```

It was migrated to:
```css
@import "./typography.css";
@import "tailwindcss";
```

But to ensure that the typography styles end up in the correct location,
it requires the `layer(…)` argument.

This PR now migrates the input to:
```css
@import "./typography.css" layer(base);
@import "tailwindcss";
```

Test plan:
---

Added an integration test where an import receives the `layer(…)`, but
an import that eventually contains `@utility` does not receive the
`layer(…)` argument. This is necessary otherwise the `@utility` will be
nested when we are processing the inlined CSS.

Running this on the Commit template, we do have a proper `layer(…)`
<img width="585" alt="image"
src="https://github.com/user-attachments/assets/538055e6-a9ac-490d-981f-41065a6b59f9">
2024-11-14 18:05:14 +01:00
..
@tailwindcss-cli Upgrade @parcel/watcher to 2.5.0 (#14978) 2024-11-13 11:38:43 +01:00
@tailwindcss-node Prepare v4.0.0-alpha.33 release (#14967) 2024-11-11 20:28:41 -05:00
@tailwindcss-postcss Prepare v4.0.0-alpha.33 release (#14967) 2024-11-11 20:28:41 -05:00
@tailwindcss-standalone Update @types/bun 1.1.11 → 1.1.13 (patch) (#14936) 2024-11-13 11:56:58 +01:00
@tailwindcss-upgrade Add missing layer(…) to imports above Tailwind directives (#14982) 2024-11-14 18:05:14 +01:00
@tailwindcss-vite Vite: Don't track candidate changes for Svelte <style> tags (#14981) 2024-11-13 16:42:49 +01:00
internal-example-plugin Prefix internal modules with internal-* (#14074) 2024-07-29 10:58:07 -04:00
tailwindcss Ensure @config is injected in common ancestor sheet (#14989) 2024-11-14 11:48:31 +01:00
tsconfig.base.json introduce v4 codebase 2024-03-05 14:29:15 +01:00