tailwindcss/packages
Robin Malfait d2865c3e58
Remove layer(utilities) if imports contain @utility (#14738)
We have a migration that adds the `layer(…)` next to the `@import`
depending on the order of original values. For example:
```css
@import "tailwindcss/utilities":
@import "./foo.css":
@import "tailwindcss/components":
```

Will be turned into:
```css
@import "tailwindcss":
@import "./foo.css" layer(utilities):
```

Because it used to exist between `utilities` and `components`. Without
this it would be _after_ `components`.

This results in an issue if an import has (deeply) nested `@utility`
at-rules after migrations. This is because if this is generated:
```css
/* ./src/index.css */
@import "tailwindcss";
@import "./foo.css" layer(utilities);

/* ./src/foo.css */
@utility foo {
  color: red;
}
```

Once we interpret this (and thus flatten it), the final CSS would look
like:
```css
@layer utilities {
  @utility foo {
    color: red;
  }
}
```

This means that `@utility` is not top-level and an error would occur.

This fixes that by removing the `layer(…)` from the import if the
imported file (or any of its children) contains an `@utility`. This is
to ensure that once everything is imported and flattened, that all
`@utility` at-rules are top-level.
2024-10-21 23:46:24 +02:00
..
@tailwindcss-cli Ensure changes to the input CSS file result in a full rebuild (#14744) 2024-10-21 20:29:33 +00:00
@tailwindcss-node Prepare v4.0.0-alpha.28 release (#14709) 2024-10-17 17:03:28 -04:00
@tailwindcss-postcss Use 0 instead of none in OKLCH values (#14741) 2024-10-21 15:54:27 -04:00
@tailwindcss-standalone Update @types/bun 1.1.10 → 1.1.11 (patch) (#14727) 2024-10-19 15:18:39 +02:00
@tailwindcss-upgrade Remove layer(utilities) if imports contain @utility (#14738) 2024-10-21 23:46:24 +02:00
@tailwindcss-vite Prepare v4.0.0-alpha.28 release (#14709) 2024-10-17 17:03:28 -04:00
internal-example-plugin Prefix internal modules with internal-* (#14074) 2024-07-29 10:58:07 -04:00
tailwindcss Use 0 instead of none in OKLCH values (#14741) 2024-10-21 15:54:27 -04:00
tsconfig.base.json introduce v4 codebase 2024-03-05 14:29:15 +01:00