4468 Commits

Author SHA1 Message Date
depfu[bot]
35bac2aadd Update autoprefixer to version 10.4.2 2022-01-26 16:44:04 +00:00
depfu[bot]
490c9dcb29 Update chokidar to version 3.5.3 2022-01-25 07:58:28 +00:00
Robin Malfait
2a9b6c9b10
add missing changelog entries 2022-01-24 14:58:44 +01:00
Robin Malfait
b1c77d6406
3.0.16 v3.0.16 2022-01-24 14:56:48 +01:00
Robin Malfait
837781ad08
update changelog 2022-01-24 14:56:48 +01:00
Jonathan Reinink
bab689ca82
Improve various warnings (#7118) 2022-01-19 15:09:13 -05:00
depfu[bot]
f8ed6a24f4 Update @swc/jest to version 0.2.17 2022-01-19 10:14:14 +00:00
Jordan Pittman
cca5a3804e Fix grammatical mistake 2022-01-17 14:21:43 -05:00
depfu[bot]
b99f380f45 Update cssnano to version 5.0.15 2022-01-17 12:58:45 +00:00
depfu[bot]
3e2a067333 Update fast-glob to version 3.2.11 2022-01-16 13:58:30 +00:00
Robin Malfait
167668e9cf
Ensure to transpile the PostCSS Nesting plugin (tailwindcss/nesting) (#7080)
* ensure that we compile the postcss nesting plugin

* re-add optional chaining

This will allow us to be 100% sure that we can safely call
hasOwnProperty in case we get some very strange objects.

This will now also be compiled/transpiled by esbuild.

* import the internal postcss nesting plugin

This allows us to work on it without re-compiling while running tests.
Just like we do with all other code.

* update changelog
2022-01-15 16:07:20 +01:00
Robin Malfait
61b68a2149
3.0.15 v3.0.15 2022-01-15 02:36:58 +01:00
Robin Malfait
ffa746129d
update changelog 2022-01-15 02:36:57 +01:00
Robin Malfait
7920850728
Temporarily remove optional chaining in nesting plugin (#7077)
* remove optional chaining

This breaks on Node versions lower than version 13. Normally we
transpile everything, but we currently don't do this for the nesting
plugin since it is not really part of the `src` folder.

Will get this fixed in a better way, but for now this is a quick fix to
get everything working again!

* update changelog
2022-01-15 02:36:34 +01:00
Robin Malfait
693608762a
3.0.14 v3.0.14 2022-01-14 18:23:18 +01:00
Robin Malfait
6eda17e691
update changelog 2022-01-14 18:23:18 +01:00
Robin Malfait
adf792b1f8
update changelog 2022-01-14 16:21:10 +01:00
Jordan Pittman
e2928883e8
Only emit utility/component variants when those layers exist (#7066) 2022-01-14 10:20:43 -05:00
Lubomír Blažek
8293c2d33d
Ensure nesting plugins can receive options (#7016)
* fix: options for nesting / nested plugins

* add tests to ensure passing options to postcss plugin works

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2022-01-14 16:20:06 +01:00
Jordan Pittman
bef3838552
Show warnings for invalid content config (#7065) 2022-01-14 09:47:39 -05:00
depfu[bot]
1eb4127de2 Update jest to version 27.4.7 2022-01-12 13:28:58 +00:00
depfu[bot]
6a97fe40d8 Update jest-diff to version 27.4.6 2022-01-11 23:28:32 +00:00
Robin Malfait
62569092e7
3.0.13 v3.0.13 2022-01-11 11:17:10 +01:00
Robin Malfait
556cdfa972
update changelog 2022-01-11 11:17:10 +01:00
depfu[bot]
c8b2b9ad78 Update resolve to version 1.21.0 2022-01-10 21:28:37 +00:00
Jordan Pittman
b5b387233f Test apply partitioning and media queries
This has already been fixed due to another change but wanted to add an explicit test for it
2022-01-10 12:45:34 -05:00
Jordan Pittman
a891867a2f
Fix consecutive builds with at apply producing different CSS (#6999)
* Partition at rules before building context

* remove unnecessary logic

* Update changelog

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2022-01-10 12:36:14 -05:00
depfu[bot]
3a13cfce7b Update @swc/core to version 1.2.127 2022-01-10 12:58:21 +00:00
depfu[bot]
d06c9d6aa9 Update eslint to version 8.6.0 2022-01-08 00:00:46 +00:00
Jordan Pittman
cd17ec03b0
Remove cross-env and postcss-cli deps (#6964) 2022-01-07 15:40:36 -05:00
Jordan Pittman
377886eb81 Update changelog 2022-01-07 12:37:47 -05:00
depfu[bot]
ee35abd97e Update esbuild to version 0.14.10 2022-01-07 16:58:20 +00:00
Robin Malfait
8e0ccda1a1
3.0.12 v3.0.12 2022-01-07 17:42:18 +01:00
Robin Malfait
3dc93c06a3
update changelog 2022-01-07 17:42:11 +01:00
Jordan Pittman
f2d73b8c3d
Change how we handle defaults (optimized or not) (#6926)
Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
2022-01-07 11:39:45 -05:00
Jesper
4bc9ca7d8b
End 'Reading changed files' timer in debug mode (#6954) 2022-01-07 17:08:15 +01:00
Robin Malfait
fe08e919dc
Ensure @apply works consistently with or without @layer (#6938)
* partition nodes as soon as possible

Time to write another story on `@apply`...

When we write code like this:

```css
.a {
  @apply b;
}

.b {
  @apply uppercase;
  color: red;
}
```

Then we create 2 Nodes in our context to keep track of. One has
identifier `a`, the other has identifier `b`. However, when we have an
`@apply` and it contains multiple declarations/atrules, then we have to
split up the (aka partition) node into multiple nodes so that we can
guarantee the correct expected sort order.

This means that the above example technically looks like this:

```css
.a {
  @apply b;
}

.b {
  @apply uppercase;
}

.b {
  color: red;
}
```

If this was your input, then we would still have 1 node for identifier
'a', but we would have 2 nodes for identifier 'b'.

As mentioned earlier, this is important to guarantee the correct order,
here is an example:

```css
.b {
  @apply md:font-bold xl:font-normal; /* Here we can sort by our
  internal rules. This means that the `md` comes before `xl`. */
}
```

... however

```css
.b {
  @apply xl:font-normal; /* This now exists _before_ the example below */
}

.b {
  @apply md:font-bold; /* Because we respect the order of the user's css */
}
```

So to guarantee the order when doing this:
```css
.b {
  @apply xl:font-normal;
  @apply lg:font-normal;
}
```

We also split this up into 2 nodes like this:
```css
.b {
  @apply xl:font-normal;
}
.b {
  @apply lg:font-normal;
}
```

The tricky part is that now only 1 empty `.b` node exists in our context
because we partitioned the orginal node into multiple nodes and moved
the children to the new nodes and because they are new nodes it means
that they have a different identity.

This partitioning used to happen in the expandApplyAtRules code, but
this is a bit too late because the context has already been filled at
this time. Instead, we move the code more to the front, as if you wrote
those separated blocks yourself. Now the code to inject those nodes into
the context happens in a single spot instead of multiple places.

Another good part about this is that we have better consistency between
each layer because it turns out that these two examples generated
different results...

```css
.a {
  @apply b;
}
.b {
  @apply uppercase;
  color: red;
}
```

... is different compared to:

```css
@tailwind components;
@layer components {
  .a {
    @apply b;
  }
  .b {
    @apply uppercase;
    color: red;
  }
}
```

Even if both `a` and `b` are being used in one of your content paths...
Yeah.. *sigh*

* add more `@apply` related tests

* update changelog

* remove support for basic nesting (leftover)

* remove leftover todo

This has been fixed already
2022-01-07 16:41:01 +01:00
Jonathan Reinink
9c72add3b7
Update changelog 2022-01-06 08:20:58 -05:00
Robin Malfait
4562b7cd59
update changelog 2022-01-06 14:17:55 +01:00
Max Veytsman
93e5717f73
Switch to using linuxstatic build target (#6914) 2022-01-06 08:13:44 -05:00
depfu[bot]
ece160cfe9 Update postcss-selector-parser to version 6.0.8 2022-01-06 12:43:34 +00:00
Robin Malfait
21fe083db0
Ensure we can apply classes defined with non-"on-demandable" selectors (#6922)
* improve extractCandidates

When we have a css rule that is defined as `.foo, .bar {}`, then we will
crawl each selector and link it to the same node. This is useful because
now our Map looks something like this:

```js
Map(2) { 'foo' => Node {}, 'bar' => Node {} }
```

This allows us to later on `@apply foo` or `@apply bar` and we can do a
direct lookup for this "candidate".

When we have css defined as `span {}`, then we consider this
"non-ondemandable". This means that we will _always_ inject these rules
into the `*` section and call it a day.

However, it could happen that you have something like this: `span, .foo
{}` up until now this was totally fine. It contains a non-ondemandable
selector (`span`) and therefore we injected this into that `*` section.

However, the issue occurs if you now try to `@apply foo`. Since we had
an early return for this use case it didn't endup in our Map from above
and now you get an error like:

```
The `foo` class does not exist. If `foo` is a custom class, make sure it
is defined within a `@layer` directive."
```

So instead what we will do is keep track whether or not a css rule
contains any on-demandable classes. If this is the case then we still
generate it always by putting it in that `*` section. However, we will
still register all on-demandable classes in our Map (in this case `.foo`).

This allows us to `@apply foo` again!

* update changelog
2022-01-06 13:27:14 +01:00
Jordan Pittman
82f163d425
Fix use of falsy values in theme config (#6917) 2022-01-05 16:37:07 -05:00
depfu[bot]
fc6c27d95b Update autoprefixer to version 10.4.1 2022-01-05 16:43:58 +00:00
Jonathan Reinink
bd4dddd71a
Update CHANGELOG.md 2022-01-05 09:34:36 -05:00
Robin Malfait
a00b9fb692
3.0.11 v3.0.11 2022-01-05 14:39:14 +01:00
Robin Malfait
24c1f8df83
update changelog 2022-01-05 14:39:06 +01:00
Robin Malfait
e3612d3d13
update changelog 2022-01-05 14:38:18 +01:00
Jordan Pittman
9fdc391d4f Revert apply defaults in isolation 2022-01-05 08:36:30 -05:00
Robin Malfait
5f49e53aba
Ignore content files that don't exist (#6901)
* ignore content files that don't exist

PostCSS CLI will give you a fake file path that ends in /stdin if you
are reading from stdin.

* update changelog
2022-01-05 14:18:41 +01:00