Commit graph

5709 commits

Author SHA1 Message Date
Robin Malfait
b5f25329a2 ensure glob entry without pattern is scanner correctly 2024-10-28 17:20:23 -04:00
Robin Malfait
8e68a9a1c4 refactor: move parent_dir outside of loop 2024-10-28 17:20:23 -04:00
Robin Malfait
d0efb45d33 ensure the patterns are prepended with the base
This is to ensure that matching files is correct.
2024-10-28 17:20:23 -04:00
Robin Malfait
60839781ca ensure we can compare GlobEntry instances 2024-10-28 17:20:23 -04:00
Robin Malfait
1b7a31c099 drop unused code, and update tests with new structure 2024-10-28 17:20:23 -04:00
Robin Malfait
d58a555f4d rename input to pattern
And make sure that we break once we find a `!`.
2024-10-28 17:20:22 -04:00
Robin Malfait
0e132dbe94 ensure glob entries are sorted
This gives us stable results, which is useful during debugging and in
tests
2024-10-28 17:20:22 -04:00
Robin Malfait
7b25fcd04c extend @source "…"; and source(…) tests
This test now makes sure that:

1. If a glob is used, and it contains `**`, then it should _not_ resolve
   ignored files/folders like `node_modules`.
2. If an explicit glob is used that contains `node_modules`, then we
   will resolve files in this folder.
3. If an explicit glob is used, and that glob includes file extensions
   we normally ignore then those files should resolve because the glob
   is explicit.
2024-10-28 17:20:22 -04:00
Robin Malfait
0e3c1a721c always log exec(…) result when using test.only or test.debug 2024-10-28 17:20:22 -04:00
Robin Malfait
eb7e5e6988 split static and dynamic part of glob, then resolve 2024-10-28 17:20:22 -04:00
Robin Malfait
22af714cc1 add globset 2024-10-28 17:20:22 -04:00
Robin Malfait
9e9c5a2595 add failing test
This proves that right now when using a glob, that files that should be
git ignored are _not_ git ignored.
2024-10-28 17:20:22 -04:00
Robin Malfait
788d61baa2 Update crates/oxide/src/lib.rs
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2024-10-28 17:20:22 -04:00
Robin Malfait
c51b20f5f5 Update packages/@tailwindcss-vite/src/index.ts
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2024-10-28 17:20:22 -04:00
Robin Malfait
6fc989150f Update packages/@tailwindcss-vite/src/index.ts
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2024-10-28 17:20:22 -04:00
Robin Malfait
488f356272 Update crates/oxide/src/lib.rs
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2024-10-28 17:20:22 -04:00
Robin Malfait
32762474e0 update all instances of new Scanner(…)
This now makes use of just `sources` instead of auto content detection.
2024-10-28 17:20:22 -04:00
Robin Malfait
e7580d1cec resolves base path in tests
Ensure symlinks are handled because `/var/` points to `/private/var/`.
2024-10-28 17:20:22 -04:00
Robin Malfait
d7f158a4bd migrate detect sources to sources 2024-10-28 17:20:22 -04:00
Robin Malfait
4c17f99cf7 add CLI watch mode tests for @source and source(…) 2024-10-28 17:20:22 -04:00
Robin Malfait
0931d4ea25 add todo for follow up PR 2024-10-28 17:20:22 -04:00
Robin Malfait
1d0d30654d cleanup console.log 2024-10-28 17:20:22 -04:00
Robin Malfait
6ab46af0bb update @tailwindcss/vite with new source(…) setup 2024-10-28 17:20:22 -04:00
Robin Malfait
535823c96d update @tailwindcss/postcss with new source(…) setup 2024-10-28 17:20:22 -04:00
Robin Malfait
546a16030e refactor: use variable directly 2024-10-28 17:20:22 -04:00
Robin Malfait
8677342e8b update test name 2024-10-28 17:20:22 -04:00
Robin Malfait
7e4b43ae54 run prettier 2024-10-28 17:20:22 -04:00
Robin Malfait
8d78912e0c expand patterns in GlobEntry 2024-10-28 17:20:22 -04:00
Robin Malfait
6c7ba2505e add bexpand for expanding glob expressions 2024-10-28 17:20:22 -04:00
Robin Malfait
354b8eaf80 provide base and pattern separately 2024-10-28 17:20:22 -04:00
Robin Malfait
78b7f5e0ab validate existence source(…) base path 2024-10-28 17:20:22 -04:00
Philipp Spiess
eba5ee702a Remove @tailwind utility nodes with parameters 2024-10-28 17:20:22 -04:00
Robin Malfait
0f73bb7d2e merge globs and detectSources
Now that we can promote `@source "../path/to/folder"` to enable auto
source detection, it means that we can just merge the globs together and
add the base folder as if it was `@source "../path/to/folder"`
2024-10-28 17:20:22 -04:00
Robin Malfait
4a8718c025 refactor, remove a level of nesting 2024-10-28 17:20:21 -04:00
Robin Malfait
482d6fc2d7 promote sources to auto source detection 2024-10-28 17:20:21 -04:00
Robin Malfait
8203a84c58 fix some clippy warnings 2024-10-28 17:20:21 -04:00
Robin Malfait
cda3ff46f2 fix turbo input paths
We used to list `core` instead of `oxide`, this should make sure that
building Oxide works if we make changes in `oxide/`.
2024-10-28 17:20:21 -04:00
Robin Malfait
7246a1b310 update test 2024-10-28 17:20:21 -04:00
Robin Malfait
aa665d3dcf forward correct source(…) to the oxide scanner 2024-10-28 17:20:21 -04:00
Robin Malfait
00d0d94d55 add integration test for source(…)
This integration test itself might change over time as we work through
this PR.
2024-10-28 17:20:21 -04:00
Robin Malfait
315e3042c7 handle source(…)
Forward it from `@media source(…)` to `@tailwind utilities source(…)`.
Next, handle `@tailwind utilities source(…)` and retrieve the path.
2024-10-28 17:20:21 -04:00
Adam Wathan
289c25f8e9
Use inline and block for x/y utilities (#14805)
This PR updates all of our x/y named utilities (like `px-*`, `my-*`,
`inset-y-*`, `scroll-px-*`, etc.) to use logical properties like
`padding-inline` instead of separate `padding-left` and `padding-right`
properties.

We held off on this originally for a while because `inline` doesn't
really mean _horizontal_ like the "x" in `px-*` implies, but I think in
practice this change is fine — I'm comfortable with "x" meaning "in the
inline direction" and "y" meaning "in the block direction" in Tailwind.

This is technically a breaking change if anyone was depending on the
fact that `px-*` for instance was always explicitly setting
`padding-left` and `padding-right` even when building something in a
vertical writing mode, but I kinda doubt there's a single real project
on the internet that will actually be affected, so not too worried about
it.

If someone _really_ wants to set `padding-left` and `padding-right` they
can always use `pl-4 pr-4` instead of `px-4`.

Nice thing about this change is it produces quite a bit less CSS.

To test this change, I re-generated all of the snapshots and made sure
none of the generated utilities changed position or anything in the
output (initially they did before I updated `property-order.ts` to add
some missing properties).

I also created a little demo locally in the Vite playground to test
things manually and make sure I didn't make any obvious typos or
anything that could slip through the snapshots:

<img width="1223" alt="image"
src="https://github.com/user-attachments/assets/0e9854ba-2b5b-4c8c-87b6-6eb7b7da84f2">

<details>
<summary>Show code for playground demo</summary>

```jsx
import React from 'react'

export function App() {
  return (
    <div className="p-12 gap-10 grid grid-cols-2 items-start">
      <div className="grid grid-cols-1 gap-10 justify-start">
        <div className="space-y-6">
          <p className="font-semibold mb-6">Border Width</p>
          <div className="border-x w-48 h-12 flex items-center justify-center">border-x</div>
          <div className="border-y w-48 h-12 flex items-center justify-center">border-y</div>
        </div>
        <div className="space-y-6">
          <p className="font-semibold mb-6">Border Color</p>
          <div className="border-2 border-x-red-500 w-48 h-12 flex items-center justify-center">
            border-x-red-500
          </div>
          <div className="border-2 border-y-red-500 w-48 h-12 flex items-center justify-center">
            border-y-red-500
          </div>
        </div>
        <div className="space-y-6">
          <p className="font-semibold mb-6">Padding</p>
          <div>
            <div className="px-8 bg-yellow-300 inline-flex items-center justify-center">px-8</div>
          </div>
          <div>
            <div className="py-8 bg-yellow-300 inline-flex items-center justify-center">py-8</div>
          </div>
        </div>
      </div>
      <div className="grid grid-cols-1 gap-10 justify-start">
        <div className="space-y-6">
          <p className="font-semibold mb-6">Margin</p>
          <div>
            <div className="bg-red-400 inline-flex">
              <div className="mx-8 bg-yellow-300 inline-flex items-center justify-center">mx-8</div>
            </div>
          </div>
          <div>
            <div className="bg-red-400 inline-flex">
              <div className="my-8 bg-yellow-300 inline-flex items-center justify-center">my-8</div>
            </div>
          </div>
        </div>
        <div className="space-y-6">
          <p className="font-semibold mb-6">Inset</p>
          <div className="relative bg-red-400 w-48 h-48">
            <div className="inset-x-8 absolute bg-yellow-300 inline-flex items-center justify-center">
              inset-x-8
            </div>
          </div>
          <div className="relative bg-red-400 w-48 h-48">
            <div className="inset-y-8 absolute bg-yellow-300 inline-flex items-center justify-center">
              inset-y-8
            </div>
          </div>
        </div>
      </div>
    </div>
  )
}
```

</details>

I didn't manually test the scroll padding or scroll margin utilities
because they are more annoying to set up, but I probably should.

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2024-10-28 13:08:39 -04:00
Jordan Pittman
e14ab1f9ee
Make config() path arg optional in v4 plugin API (#14799)
Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2024-10-28 12:05:57 -04:00
Philipp Spiess
5b2f6c7506
Revert "Fix Astro integration test by pinning zod-to-json-schema" (#14792)
Reverts tailwindlabs/tailwindcss#14780

The version pin is no longer needed. 🙂 

## Test Plan

CI is green again.
2024-10-25 11:31:34 +02:00
Jordan Pittman
10a8f1a725
Prepare v4.0.0-alpha.30 release (#14789) 2024-10-24 16:22:08 -04:00
Robin Malfait
f83041852d
Handle feedback from #14783 (#14788)
This PR is a continuation of #14783 to handle the feedback on that PR.

1. Update the test to be more realistic
2. Updated the comment

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2024-10-24 16:11:59 -04:00
Adam Wathan
1eab49d0b1
Sort text wrapping utilities with typography utilities (#14787)
This PR implements some changes to the way we sort typography utilities,
inspired by #14715.

Prior to this PR, utilities like `text-balance`, `break-words`, and
`text-center` were sorted very early, even before things like border
utilities:

```html
<div class="text-balance break-words border-2 border-blue-500 text-center indent-5 text-2xl font-medium capitalize leading-6 tracking-tight text-red-500 underline"></div>
```

This PR changes the sort order to co-locate these with other typography
utilities which feels a lot more natural:

```html
<div class="border-2 border-blue-500 text-center indent-5 text-2xl leading-6 font-medium tracking-tight text-balance break-words text-red-500 capitalize underline"></div>
```

I've also made some small adjustments to how other typography properties
are sorted based on pairing with @reinink and just deciding what felt
the most intuitive to us and matched the order we'd likely type things
in manually.

To test this change I temporarily added a new test to `sort.test.ts` to
make sure the classes were sorted in the expected order:

```js
  [
    // Input
    'text-red-500 text-center capitalize text-2xl break-words text-balance underline font-medium tracking-tight leading-6 indent-5',

    // Expected
    'text-center indent-5 text-2xl leading-6 font-medium tracking-tight text-balance break-words text-red-500 capitalize underline',
  ],
```

Didn't keep the test around because there's no real logic to test here
(it just matches the order in the `property-order.ts` file) and we don't
have any other tests like this.

I've also made some minor unrelated changes here like deleting legacy
properties from `property-order.ts` that are never used, and fixing a
typo where we wrote `work-break` instead of `word-break`.

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2024-10-24 16:10:20 -04:00
Jordan Pittman
3fe53dd8f0
Update changelog details and naming around the new not-* variant (#14785)
I've tweaked the changelog with suggestions from @adamwathan to improve
clarity around what the actual changes are.

I also renamed `compoundWith` back to `compound` — I felt that it made
sense at the time but keeping the old name definitely feels better the
more I think about it.
2024-10-24 14:50:20 -04:00
Robin Malfait
430836f651
Ensure layer(…) on @import is only removed when @utility is present (#14783)
This PR fixes an issue where `layer(…)` next to imports were removed
where they shouldn't have been removed.

The issue exists if _any_ of the `@import` nodes in a file contains
`@utility`, if that's the case then we removed the `layer(…)` next to
_all_ `@import` nodes.

Before we were checking if the current sheet contained `@utility` or in
any of its children (sub-`@import` nodes).

This fixes that by looping over the `@import` nodes in the current
sheet, and looking for the `@utility` in the associated/imported file.
This way we update each node individually.

Test plan:
---

Added a dedicated integration test to make sure all codemods together
result in the correct result. Input:

96e8908378/integrations/upgrade/index.test.ts (L2076-L2108)

Output:

96e8908378/integrations/upgrade/index.test.ts (L2116-L2126)
2024-10-24 14:33:10 -04:00
Jordan Pittman
148d8707b9
Improve support for custom variants in group-*, peer-*, has-*, and not-* variants (#14743)
Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2024-10-24 13:27:27 -04:00