5979 Commits

Author SHA1 Message Date
Robin Malfait
81de67c5ff
Cleanup Tailwind Play workflow (#16310)
This PR cleans up the Tailwind Play update by removing unnecessary
inputs because Tailwind Play will take care of this.
2025-02-06 18:56:29 +00:00
Martin SCHNEIDER
25b42789b0
Remove useless console.log in @tailwind/vite package (#16307) 2025-02-06 16:54:21 +00:00
Robin Malfait
83fdf373aa
Prepare v4.0.4 (#16302)
Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
v4.0.4
2025-02-06 15:18:11 +01:00
Philipp Spiess
144581d3e4
Properly skip over nodes when using replaceNode (#16300)
Fixes #16298 

This PR fixes an issue where using an AST walk in combination with
`replaceNode` and various `SkipAction` would either cause children to be
visited multiple times or not visited at all even though it should. This
PR fixes the issue which also means we can get rid of a custom walk for
`@variant` inside the `@media` that was used to apply `@variant` because
we never recursively visited children inside the `@media` rule.

Because we now can use the regular walk for `@variant`, we now properly
convert `@variant` to `@custom-variant` inside `@reference`-ed
stylesheet which also fixes #16298

## Test plan

Lots of tests added to ensure the combinations of `WalkAction` and
`replaceWith()` works as expected.
2025-02-06 14:30:04 +01:00
Philipp Spiess
1e949af9a1
Standalone: Use bun baseline builds for Linux (#16244)
Closes #15181

This PR changes the Standalone builds to use bun baseline instead. This
compiles to a reduced instruction set and should work around the
compatibility issues experienced across older server hardware.

## Test plan

See
https://github.com/tailwindlabs/tailwindcss/issues/15181#issuecomment-2634621266

Also tested it with the repor from @npezza93 and it now works locally as
well with a Docker build.
2025-02-06 14:29:54 +01:00
Robin Malfait
d566dbdef6
Improve performance of rebuilds (#16283)
This PR introduces a performance improvement we noticed while working on
on: https://github.com/tailwindlabs/tailwindcss/pull/16211

We noticed that `substituteFunctions` was being called on every `node`
after the `compileAstNodes` was done. However, the `compileAstNodes` is
heavily cached.

By moving the `substituteFunctions` we into the cached `compileAstNodes`
we sped up performance for Catalyst rebuilds from ~15ms to ~10ms.


| Before | After |
| --- | --- |
| <img width="710" alt="image"
src="https://github.com/user-attachments/assets/eaf110d9-2f88-447c-9b10-c77d47bd99a5"
/> | <img width="696" alt="image"
src="https://github.com/user-attachments/assets/c5a2ff4c-d75e-4e35-a2b6-d896598810f5"
/> |
2025-02-05 18:46:14 +01:00
Philipp Spiess
837e240b4d
Add Freebsd build target (#16277)
Closes #15731

This PR adds a FreeBSD build target to our CI workflows. It was tested
on CI:
https://github.com/tailwindlabs/tailwindcss/actions/runs/13159185517/job/36723613079

However, due to the build not emitting final npm packages, we don't have
a way to actually test the final package before we ship it to an
insiders release.

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2025-02-05 15:48:05 +00:00
depfu[bot]
0ecc22b5cc
Update all of nextjs 15.1.4 → 15.1.6 (patch) (#16257) 2025-02-05 16:22:35 +01:00
Philipp Spiess
3f8e7647b6
Take NODE_PATH into account when resolving modules (#16274)
Fixes #15847

This PR changes the node specific resolver config to takes the eventual
`NODE_PATH` env into account.

## Test plan

See #15847

<img width="1273" alt="Screenshot 2025-02-05 at 12 58 20"
src="https://github.com/user-attachments/assets/8e1b99d1-608d-437a-a7b2-212feb153da5"
/>
2025-02-05 16:21:31 +01:00
Robin Malfait
82d486adb5
Fix order-first and order-last for Firefox (#16266)
This PR fixes an issue where `order-last` doesn't work as expected in
Firefox.

The implementation of `order-last`, looks like this: 
```css
.order-last {
  order: calc(infinity);
}
```

Which is valid CSS, and `calc(infinity)` is even valid in Firefox. You
can use this in other properties such as `border-radius`:
```css
.rounded-full {
  border-radius: calc(infinity * 1px);
}
```

While this works, in properties like `order` it just doesn't work.

Fixes: #16165
2025-02-05 12:04:43 +01:00
Philipp Spiess
3b61277e7a
Don't crash when setting JS theme value to null (#16210)
Closes #16035

In v3 it was possible to unset a specific color namespace by setting
doing something like this:

```js
export default {
  theme: {
    extend: {
      colors: {
        red: null,
      },
    },
  },
}
```

This pattern would crash in v4 right now due to the theme access
function not being able to work on the red property being a `null`. This
PR fixes this crash.

However it leaves the behavior as-is for now so that the red namespace
_defined via CSS will still be accessible_. This is technically
different from v3 but fixing this would be more work as we only allow
unsetting top-level namespaces in the interop layer (via the
non-`extend`-theme-object). I would recommend migrating to the v4 API
for doing these partial namespace resets if you want to get rid of the
defaults in v4:

```css
@theme {
  --color-red-*: initial;
}
```

## Test plan

The crash was mainly captured via the test in `compat/config.test.ts`
but I've added two more tests across the different levels of
abstractions so that it's clear what `null` should be doing.

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2025-02-04 15:43:48 +01:00
Philipp Spiess
5601fb50a9
Upgrade @parcel/watcher to 2.5.1 (#16248)
Closes #16225
2025-02-04 15:14:52 +01:00
Philipp Spiess
9fd6766308
Ensure first argument to var(…) still unescapes \_ (#16206)
Resolves #16170

This PR fixes an issue where the previously opted-out escaping of the
first argument for the `var(…)` function was not unescaped at all. This
was introduced in https://github.com/tailwindlabs/tailwindcss/pull/14776
where the intention was to not require escaping of underscores in the
var function (e.g. `ml-[var(--spacing-1_5)]`). However, I do think it
still makes sense to unescape an eventually escaped underline for
consistency.

## Test plan

The example from #1670 now parses as expected:

<img width="904" alt="Screenshot 2025-02-03 at 13 51 35"
src="https://github.com/user-attachments/assets/cac0f06e-37da-4dcb-a554-9606d144a8d5"
/>

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2025-02-04 15:13:18 +01:00
Philipp Spiess
e1a85ac260
Vite: Skip parsing stylesheets with the ?commonjs-proxy flag (#16238)
Fixes #16233

Vite has a number of special parameters that can be appended to `.css`
files that make it actually load as a JavaScript module. One such
parameter that we haven't handled before is the `?commonjs-proxy` flag.
When importing e.g. `plotly.js/lib/core`, the dependency tree would
eventually load a file called `*.css?commonjs-proxy`. We previously
scanned this for candidates even though it was not, in-fact, a
stylesheet.

This PR fixes this by adding the `?commonjs-proxy` to the ignore list. I
have also updated `SPECIAL_QUERY_RE` to more closely match the Vite
implementation. It does seem like this was the only condition we were
missing, though:
2b2299cbac/packages/vite/src/node/plugins/css.ts (L511-L517)

## Test plan

Add and import `plotly.js/lib/core` into a Vite app. I also added an
integration test to do that.

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2025-02-04 12:45:23 +01:00
Robin Malfait
06dfa399e6
Ensure we always emit @keyframes correctly (#16237)
This PR fixes an issue where we didn't always generate the `@keyframes`.
Right now we only generate `@keyframes` _if_ they are being used as one
of the `--animate-*` utilities.

However, if your `--animate-*` definition is pretty long such that it is
defined across multiple lines, then we didn't always generate the
`@keyframes` for it.

This is because the animation name would look like
`'my-animation-name\n'` instead of `'my-animation-name'`.

Fixes: #16227
2025-02-04 11:38:31 +00:00
Vũ Văn Dũng
ac202ffd50
Update upgrade CLI to handle containers config correctly (#16169) 2025-02-03 15:16:14 +01:00
depfu[bot]
b8d8548a5e
Update tsup 8.2.4 → 8.3.6 (minor) (#16155) 2025-02-03 11:20:51 +01:00
Robin Malfait
b7c3f50143
Prepare v4.0.3 (#16146) v4.0.3 2025-02-01 12:38:55 +01:00
Justin Wong
b7436f8b59
Fix @import url() being stripped (#16144) 2025-02-01 12:16:16 +01:00
Robin Malfait
50bafce756
Prepare for v4.0.2 release (#16131)
Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
v4.0.2
2025-01-31 19:30:36 +01:00
Jordan Pittman
4052eb24bf
Allow @variant to be used at the top-level (#16129)
This makes it so `@variant` is replaced at the top level and not just
within rules. This also fixes a bug where `@variant` wasn't handled when
inside an `@media` at-rule.
2025-01-31 19:18:11 +01:00
Robin Malfait
7f1d0970c3
Do not emit empty rules/at-rules (#16121)
This PR is an optimization where it will not emit empty rules and
at-rules. I noticed this while working on
https://github.com/tailwindlabs/tailwindcss/pull/16120 where we emitted:
```css
:root, :host {
}
```

There are some exceptions for "empty" at-rules, such as:

```css
@charset "UTF-8";
@layer foo, bar, baz;
@custom-media --modern (color), (hover);
@namespace "http://www.w3.org/1999/xhtml";
```

These don't have a body, but they still have a purpose and therefore
they will be emitted.

However, if you look at this:

```css
/* Empty rule */
.foo {
}

/* Empty rule, with nesting */
.foo {
  .bar {
  }
  .baz {
  }
}

/* Empty rule, with special case '&' rules */
.foo {
  & {
    &:hover {
    }
    &:focus {
    }
  }
}

/* Empty at-rule */
@media (min-width: 768px) {
}

/* Empty at-rule with nesting*/
@media (min-width: 768px) {
  .foo {
  }

  @media (min-width: 1024px) {
    .bar {
    }
  }
}
```

None of these will be emitted.

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2025-01-31 17:56:52 +01:00
Jordan Pittman
35a5e8cb64
Discard invalid declarations when parsing CSS (#16093)
I discovered this when triaging an error someone had on Tailwind Play.

1. When we see a `;` we often assume a valid declaration precedes it but
that may not be the case
2. When we see the name of a custom property we assume everything that
follows will be a valid declaration but that is not necessarily the case
3. A bare identifier inside of a rule is treated as a declaration which
is not the case

This PR fixes all three of these by ignoring these invalid cases. Though
some should probably be turned into errors.

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2025-01-31 15:53:02 +01:00
Philipp Spiess
95722020fe
Vite: Transform <style> blocks in html files (#16069)
Fixes #16036

This adds a new rule to treat `<style>` blocks found within `.html` file
as Tailwind CSS targets.

## Test plan

- Tested using the Vite extension (dev) and a new integration test
(prod)

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2025-01-31 14:26:45 +00:00
Philipp Spiess
deb33a93ab
Vite: Don't rebase urls that appear to be aliases (#16078)
Closes #16039

This PR changes our URL rebasing logic used with Vite so that it does
not rebase URLs that look like common alias paths (e.g. urls starting in
`~`, `@` or `#`, etc.). Unfortunately this is only an approximation and
you can configure an alias for a path that starts with a regular
alphabetical character (e.g. `foo` => `./my/foo`) so this isn't a
perfect fix, however in practice most aliases will be prefixed with a
symbol to make it clear that it's an alias anyways.

One alternative we have considered is to only rebase URLs that we know
are relative (so they need to start with a `.`). This, however, will
break common CSS use cases where urls are loaded like this:

```css
background: image-set(
  url('image1.jpg') 1x,
  url('image2.jpg') 2x
);
``` 

So making this change felt like we only trade one GitHub issue for
another one.

In a more ideal scenario we try to resolve the URL with the Vite
resolver (we have to run the resolver and can't rely on the `resolve`
setting alone due to packages like
[`vite-tsconfig-paths`](https://www.npmjs.com/package/vite-tsconfig-paths)),
however even then we can have relative paths being resolvable to
different files based on wether they were rebased or not (e.g. when an
image with the same filename exists in two different paths).

So ultimately we settled on extending the already existing blocklist
(which we have taken from the Vite implementation) for now.

## Test plan

- Added unit test and it was tested with the Vite playground.

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2025-01-31 15:23:32 +01:00
Philipp Spiess
60e61950b9
Ensure escaped theme variables are handled correctly (#16064)
This PR ensures that escaped theme variables are properly handled. We do
this by moving the `escape`/`unescape` responsibility back into the main
tailwindcss entrypoint that reads and writes from the CSS and making
sure that _all internal state of the `Theme` class are unescaped
classes.

However, due to us accidentally shipping the part where a dot in the
theme variable would translate to an underscore in CSS already, this
logic is going to stay as-is for now.

Here's an example test that visualizes the new changes:

```ts
expect(
  await compileCss(
    css`
      @theme {
        --spacing-*: initial;
        --spacing-1\.5: 2.5rem;
        --spacing-foo\/bar: 3rem;
      }
      @tailwind utilities;
    `,
    ['m-1.5', 'm-foo/bar'],
  ),
).toMatchInlineSnapshot(`
  ":root, :host {
    --spacing-1\.5: 2.5rem;
    --spacing-foo\\/bar: 3rem;
  }

  .m-1\\.5 {
    margin: var(--spacing-1\.5);
  }

  .m-foo\\/bar {
    margin: var(--spacing-foo\\/bar);
  }"
`)
```

## Test plan

- Added a unit test
- Ensure this works end-to-end using the Vite playground:
   
<img width="1016" alt="Screenshot 2025-01-30 at 14 51 05"
src="https://github.com/user-attachments/assets/463c6fd5-793f-4ecc-86d2-5ad40bbb3e74"
/>
2025-01-31 15:20:18 +01:00
Robin Malfait
3aa0e494bf
Do not emit @keyframes in @theme reference (#16120)
This PR fixes na issue where `@keyframes` were emitted if they wre in a
`@theme
reference` and anothe `@theme {}` (that is not a reference) was present.

E.g.:

```css
@reference "tailwindcss";

@theme {
  /* ... */
}
```

Produces:
```css
:root, :host {
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}
@keyframes pulse {
  50% {
    opacity: 0.5;
  }
}
@keyframes bounce {
  0%, 100% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: none;
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}
```

With this PR, the produced CSS looks like this instead:
```css
:root, :host {
}
```

Note: the empty `:root, :host` will be solved in a subsequent PR.

### Test plan

Added some unit tests, and a dedicated integration test.
2025-01-31 15:13:17 +01:00
Siriwat K
88c890615a
Prevent modifying CSS variables in plugins (#16103)
closes #16100

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
Co-authored-by: Philipp Spiess <hello@philippspiess.com>
2025-01-31 12:44:30 +01:00
depfu[bot]
d85e9cfcab
Update turbo 2.3.3 → 2.3.4 (patch) (#16084)
Here is everything you need to know about this update. Please take a
good look at what changed and the test results before merging this pull
request.

### What changed?




#### ✳️ turbo (2.3.3 → 2.3.4) ·
[Repo](https://github.com/turborepo/turbo)





Sorry, we couldn't find anything useful about this release.











---
![Depfu
Status](https://depfu.com/badges/edd6acd35d74c8d41cbb540c30442adf/stats.svg)

[Depfu](https://depfu.com) will automatically keep this PR
conflict-free, as long as you don't add any commits to this branch
yourself. You can also trigger a rebase manually by commenting with
`@depfu rebase`.

<details><summary>All Depfu comment commands</summary>
<blockquote><dl>
<dt>@​depfu rebase</dt><dd>Rebases against your default branch and
redoes this update</dd>
<dt>@​depfu recreate</dt><dd>Recreates this PR, overwriting any edits
that you've made to it</dd>
<dt>@​depfu merge</dt><dd>Merges this PR once your tests are passing and
conflicts are resolved</dd>
<dt>@​depfu cancel merge</dt><dd>Cancels automatic merging of this
PR</dd>
<dt>@​depfu close</dt><dd>Closes this PR and deletes the branch</dd>
<dt>@​depfu reopen</dt><dd>Restores the branch and reopens this PR (if
it's closed)</dd>
<dt>@​depfu pause</dt><dd>Ignores all future updates for this dependency
and closes this PR</dd>
<dt>@​depfu pause [minor|major]</dt><dd>Ignores all future minor/major
updates for this dependency and closes this PR</dd>
<dt>@​depfu resume</dt><dd>Future versions of this dependency will
create PRs again (leaves this PR as is)</dd>
</dl></blockquote>
</details>

Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2025-01-31 11:01:13 +00:00
depfu[bot]
0589d7d386
Update @playwright/test 1.49.1 → 1.50.0 (minor) (#16091) 2025-01-31 11:22:45 +01:00
Philipp Spiess
c09bb5e256
Fix Vite issues with SolidStart (#16052)
Fixes #16045

This PR fixes two Vite issues found with SolidStart:

- SolidStart seems to emit an empty HTML chunk (where the content is
literally just `/`) with _no pathname_. Since we use the path to
generate an `id` for HTML chunks, this would currently cause a crash.
This was reported in #16045
- While testing the fix for the above, we also found that hot reloading
was not working in SolidStart since `4.0.0-alpha.22`. After doing some
bisecting we found that this is happening as SolidStart has the same
module ID in different servers and we were invalidating the root when we
shouldn't. After trying to restructure this code so that it only cleans
up the root when it is _no longer part of any server_, we noticed some
other compatibility issues with Nuxt and SvelteKit. It seems that the
safest bet is to no longer update a root at all during rebuilds in the
SSR step. This makes `invalidateAllRoots` a function that only notifiers
the servers about a change which is conceptually also less confusing.

## Test plan

- Added an integration test for SolidStart dev mode
- Manually tested the dev mode across all Vite based templates in
https://github.com/philipp-spiess/tailwindcss-playgrounds: Astro, Nuxt,
Remix, Solid, SvelteKit, and Vue.

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2025-01-30 16:58:20 +01:00
Robin Malfait
224294122b
Refactor gradient implementation to work around prettier/prettier#17058 (#16072)
This PR fixes an issue where tools like Prettier remove important
trailing commas in CSS variables, making gradients invalid.

We encoded the `,` in the `--tw-gradient-position` to ensure that _if_
the `var(--tw-gradient-position)` is used, that the `,` was there. And
if the variable was _not_ used that we didn't end up with a double `,,`
rendering the gradient invalid.

However, when running Prettier (there might be other tools that do this
as well), the trailing comma in the `--tw-gradient-position` was removed
which made the entire gradient invalid. E.g.:
```diff
  .bg-gradient-to-r {
-   --tw-gradient-position: to right in oklab,;
+   --tw-gradient-position: to right in oklab;
    background-image: linear-gradient(var(--tw-gradient-stops));
  }
```
Notice how the `,` is removed.

This PR fixes that, by moving the `,` to where the variable is being
used. The only side effect is that we have to guarantee that the
`--tw-gradient-position` is always present. In our testing (and using UI
tests) this should be the case.

Related Prettier issue:
https://github.com/prettier/prettier/issues/17058

Fixes: #16037
2025-01-30 15:46:29 +00:00
Robin Malfait
0d5e2be312
Ensure we process Tailwind CSS features when using @reference (#16057)
This PR fixes an issue where if you only used `@reference` that we
didn't process Tailwind CSS features.

We have a 'quick bail check', in the PostCSS plugin to quickly bail if
we _konw_ that we don't need to handle any Tailwind CSS features. This
is useful in Next.js applications where every single CSS file will be
passed to the PostCSS plugin.

If you use custom font ins Next.js, each of those fonts will have a CSS
file as well.

Before we introduced `@reference`, we used `@import "tailwindcss"
reference`, which passed the bail check because `@import` was being
used. Now we have `@reference` which wasn't included in the list.

This is now solved.

Fixes: #16056


### Test plan

Added a failing test that is now failing after the fix.
2025-01-30 15:29:08 +00:00
Robin Malfait
ea24995749
Only generate positive grid-cols-* and grid-rows-* utilities (#16020)
This PR fixes an issue where `grid-cols-0` and `grid-rows-0` generated
invalid CSS. We now ensure that the value is any positive integer
(except 0).

Fixes: #16012
2025-01-29 19:56:23 +00:00
Philipp Spiess
06552092bd
Prepare v4.0.1 release (#16018)
Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
v4.0.1
2025-01-29 14:14:35 -05:00
Philipp Spiess
a4761ea967
Do not scan tailwind-merge sources for candidates (#16005)
Resolves #15722

This PR adds a list of ignored dependencies (in the current form only
`tailwind-merge`) to the Vite extension which, when included in the
dependency tree, are no longer scanned by the Tailwind CSS compiler for
candidates. This is to work around an issue where some dependencies
contain vast lists of valid Tailwind CSS class names which would
otherwise always be inlined in the build.

## Test plan

This was tested in our Vite playground on both dev and prod builds
across macOS and Windows:

### Windows prod build before

![telegram-cloud-photo-size-4-5823632138052944949-y](https://github.com/user-attachments/assets/a2bca1c7-cef3-4f04-a588-cbf1afdbdd37)

### Windows prod build after

This includes a debug `console.log(…)` to make sure it matches the right
module.

![telegram-cloud-photo-size-4-5823632138052944951-y](https://github.com/user-attachments/assets/109b82c5-1946-4d44-b812-d68474686eb7)

### Windows dev build after

This includes a debug `console.log(…)` to make sure it matches the right
module.

![telegram-cloud-photo-size-4-5823632138052944948-y](https://github.com/user-attachments/assets/41cbe7f1-f997-4c6c-b5fe-01d574f7a999)
2025-01-29 17:32:06 +01:00
Hugo van Rijswijk
9fef2bde50
Add :host rule to @theme layer (#15975)
Resolves #15799
Resolves #14478
Part-of #15005

Adds a `:host` selector for the `@theme` layer. This is necessary for
the `@theme` layer to work correctly in shadow DOM.

Also updates the snapshots for the tests that were affected by this
change (in a separate commit).

## Test plan

Tested via the Vite playground:

<img width="1121" alt="Screenshot 2025-01-29 at 15 06 49"
src="https://github.com/user-attachments/assets/a7908135-5ff8-472f-a053-d2c6d5c81e1b"
/>

Additionally made sure that `@property` defaults also work across
Firefox, Chrome, and Safari (the `@property` definition from the root is
pulled in) and added a UI spec.

---------

Co-authored-by: Philipp Spiess <hello@philippspiess.com>
2025-01-29 17:20:29 +01:00
Robin Malfait
924dd69bdb
Ensure @custom-variant foo () has a non-empty selector list (#16009)
This PR fixes an issue where an empty selector list was valid when
defining a `@custom-variant`.

Given this input:
```css
@custom-variant foo ();
```

If you then use it with a utility such as `foo:flex`, then the following
(incorrect) CSS was generated:

```css
.foo\:flex {
   {
    display: flex;
  }
}
```

Which is invalid CSS. This PR will now validate that that we have at
least _something_ and show an error accordingly.
2025-01-29 16:09:09 +01:00
Robin Malfait
965048c01a
Remove the force variant (#16007)
This PR will remove the `force` variant. This was an experiment that we
accidentally shipped, but there is no documentation nor is there any
intellisense autocompletion for it.
2025-01-29 15:32:37 +01:00
Robin Malfait
3da9d61371
Correctly migrate leading-* classes (#16004)
This PR fixes the upgrade tool by properly migrating the
`leading-[<number>]` classes.

The issue is that `leading-[<number>]` maps to the number directly, but
if you use a bare value, then it's a multiplier for based on the
`--spacing` value.

E.g.:

*leading-[2]*:
```css
.leading-\[2\] {
  --tw-leading: 2;
  line-height: 2;
}
@property --tw-leading {
  syntax: "*";
  inherits: false;
}
```

*leading-2*:
```css
.leading-2 {
  --tw-leading: calc(var(--spacing) * 2);
  line-height: calc(var(--spacing) * 2);
}
@property --tw-leading {
  syntax: "*";
  inherits: false;
}
```

This PR will now prevent migrating arbitrary values to bare values for
`leading-*` utilities.

That said, this does introduce a small improvement where `leading-[1]`
is migrated to `leading-none`.

Fixes: https://github.com/tailwindlabs/tailwindcss/issues/15924
2025-01-29 15:22:13 +01:00
Robin Malfait
125c0891b1
update changelog 2025-01-29 11:48:01 +01:00
Xetera
9bfeb337e2
Fix resolve_globs crash when at root directory (#15988)
Fixes a crash found in Dockerfiles when a build takes place at the root
directory. It's not a good practice to keep your application logic in
`/`, but it probably shouldn't cause a crash either.

I found this particularly difficult to write tests for because it would
involve either running a glob on my real filesystem starting from `/` or
mocking the calls to `fs` which as far as I can tell isn't supported in
the codebase and would be out of scope to try to do here.

Fixes #15987
2025-01-29 11:45:33 +01:00
Philipp Spiess
f237f59580 Add missing changelog entry for #15978 2025-01-28 17:38:01 +01:00
Robin Malfait
2d3c196591
Rename next to main (#15980)
This PR renames `next` to `main` in GitHub Action Workflows and the
CONTRIBUTING.md file.
2025-01-28 11:31:54 -05:00
Philipp Spiess
b492187c49
Fix Oxide scanner bugs (#15974)
Fixes #15632
Fixes #15740

This PR fixes a number of Oxide scanner bugs reported over various
channels, specifically:

- When using the Svelte class shorthand split over various lines, we
weren't extracting class names properly:
   
   ```svelte
   <div
     class:underline={isUnderline}>
   </div>
   ```
- We now extract classes when using the class shortcut in Angular:
   
   ```html
   <div [class.underline]=\"bool\"></div>
   ```
- We now validate parentheses within arbitrary candidates so that we
don't consume invalid arbitrary candidates anymore which allows us to
parse the following case properly:
   
   ```js
   const classes = [wrapper("bg-red-500")]
   ```


## Test plan

Added unit tests

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2025-01-28 17:19:31 +01:00
Jordan Pittman
e02a29fa94
Don’t look at ignore files outside initialized repos (#15941)
Right now, when Oxide is scanning for files, it considers ignore files
in the "root" directory it is scanning as well as all parent
directories.

We honor .gitignore files even when not in a git repo as an optimization
in case a project has been created, contains a .gitignore, but no repo
has actually been initialized. However, this has an unintended side
effect of including ignore files _ouside of a repo_ when there is one.
This means that if you have a .gitignore file in your home folder it'll
get applied even when you're inside a git repo which is not what you'd
expect.

This PR addresses this by checking to see the folder being scanned is
inside a repo and turns on a flag that ensures .gitignore files from the
repo are the only ones used (global ignore files configured in git still
work tho).

This still needs lots of tests to make sure things work as expected.

Fixes #15876

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2025-01-28 16:13:16 +00:00
Robin Malfait
86264a9e66
Revert "Update bun 1.1.43 → 1.2.0 (minor) (#15922)"
This reverts commit d66d7aba6f2fe6f73f748bb208ebb9beb03ddab2.
2025-01-28 17:03:17 +01:00
Philipp Spiess
82ddc249c3
Ensure browser package does not pollute global namespace (#15978)
Resolves #15977

Our `@tailwindcss/browser` build is intended to run inside a `<script>`
tag inside browsers. Because of how variable assignment within
`<script>` tags work, all variables that were defined within that script
are currently assigned on the global namespace.

This is especially troublesome as eslint uses `$` as a valid mangling
character so importing the CDN build would now redefine `globalThis.$`
which collides with many very popular JavaScript libraries.

In order to avoid polluting the global namespace, this PR changes the
build step to emit an IIFE (so all vars defined are scroped to the
function closure instead of the global namespace).

## Test plan

- Ensure UI tests still work
- <img width="533" alt="Screenshot 2025-01-28 at 16 49 27"
src="https://github.com/user-attachments/assets/1e027451-f58b-4252-bf97-c016a90eb78b"
/>
2025-01-28 16:58:08 +01:00
depfu[bot]
b009afa4ae
Update @types/react-dom 19.0.2 → 19.0.3 (patch) (#15669)
Here is everything you need to know about this update. Please take a
good look at what changed and the test results before merging this pull
request.

### What changed?




#### ✳️ @​types/react-dom (19.0.2 → 19.0.3) ·
[Repo](https://github.com/DefinitelyTyped/DefinitelyTyped)





Sorry, we couldn't find anything useful about this release.











---
![Depfu
Status](https://depfu.com/badges/edd6acd35d74c8d41cbb540c30442adf/stats.svg)

[Depfu](https://depfu.com) will automatically keep this PR
conflict-free, as long as you don't add any commits to this branch
yourself. You can also trigger a rebase manually by commenting with
`@depfu rebase`.

<details><summary>All Depfu comment commands</summary>
<blockquote><dl>
<dt>@​depfu rebase</dt><dd>Rebases against your default branch and
redoes this update</dd>
<dt>@​depfu recreate</dt><dd>Recreates this PR, overwriting any edits
that you've made to it</dd>
<dt>@​depfu merge</dt><dd>Merges this PR once your tests are passing and
conflicts are resolved</dd>
<dt>@​depfu cancel merge</dt><dd>Cancels automatic merging of this
PR</dd>
<dt>@​depfu close</dt><dd>Closes this PR and deletes the branch</dd>
<dt>@​depfu reopen</dt><dd>Restores the branch and reopens this PR (if
it's closed)</dd>
<dt>@​depfu pause</dt><dd>Ignores all future updates for this dependency
and closes this PR</dd>
<dt>@​depfu pause [minor|major]</dt><dd>Ignores all future minor/major
updates for this dependency and closes this PR</dd>
<dt>@​depfu resume</dt><dd>Future versions of this dependency will
create PRs again (leaves this PR as is)</dd>
</dl></blockquote>
</details>

Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2025-01-28 16:55:56 +01:00
depfu[bot]
d66d7aba6f
Update bun 1.1.43 → 1.2.0 (minor) (#15922)
Here is everything you need to know about this upgrade. Please take a
good look at what changed and the test results before merging this pull
request.

### What changed?




#### ✳️ bun (1.1.43 → 1.2.0) · [Repo](https://github.com/oven-sh/bun)





Sorry, we couldn't find anything useful about this release.











---
![Depfu
Status](https://depfu.com/badges/edd6acd35d74c8d41cbb540c30442adf/stats.svg)

[Depfu](https://depfu.com) will automatically keep this PR
conflict-free, as long as you don't add any commits to this branch
yourself. You can also trigger a rebase manually by commenting with
`@depfu rebase`.

<details><summary>All Depfu comment commands</summary>
<blockquote><dl>
<dt>@​depfu rebase</dt><dd>Rebases against your default branch and
redoes this update</dd>
<dt>@​depfu recreate</dt><dd>Recreates this PR, overwriting any edits
that you've made to it</dd>
<dt>@​depfu merge</dt><dd>Merges this PR once your tests are passing and
conflicts are resolved</dd>
<dt>@​depfu cancel merge</dt><dd>Cancels automatic merging of this
PR</dd>
<dt>@​depfu close</dt><dd>Closes this PR and deletes the branch</dd>
<dt>@​depfu reopen</dt><dd>Restores the branch and reopens this PR (if
it's closed)</dd>
<dt>@​depfu pause</dt><dd>Ignores all future updates for this dependency
and closes this PR</dd>
<dt>@​depfu pause [minor|major]</dt><dd>Ignores all future minor/major
updates for this dependency and closes this PR</dd>
<dt>@​depfu resume</dt><dd>Future versions of this dependency will
create PRs again (leaves this PR as is)</dd>
</dl></blockquote>
</details>

Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
2025-01-28 15:40:09 +00:00