Commit graph

15 commits

Author SHA1 Message Date
Robin Malfait
a1246de6a5
WIP: New @apply logic
use `lightningcss` and `prettier` for `toMatchFormattedCss`

Lightning CSS applies some optimizations and prettier ensures that the
output is always formatted in the same way.

In a future version, we will be using Lightning CSS to apply
optimizations like handling the nesting, optimizing selectors, sorting
declarations, simplifying colors and so on.

To guarantee that we have the same output in both the normal version and
OXIDE version, we can apply lightningcss in our tests so that it always
produces correct results in both version with the same optimizations
applied.

This also aliases `toMatchCss` to `toMatchFormattedCss` so that we can
guarantee the same output. This has a small caveat where `lightningcss`
is pretty strict. It will complain about `@media screen(md) {}` for
example. This is correct because it is not valid CSS, but we eventually
take care of it.
In this case, we will catch the error and use prettier instead (since
this should only happen in tests that doesn't use end-to-end tests, but
uses a more specialized test instead). If prettier still finds an error,
we will ensure to throw the original error.

Eventually, all the "lower" level tests, should probably become higher
level end-to-end tests. But let's do everything step by step!
2023-01-05 16:20:24 +01:00
Adam Wathan
e3d27e89b9
Move TS to ./src/oxide 2023-01-05 16:01:58 +01:00
Jordan Pittman
9b6a2c7c5e
Defer to existing CLI for Oxide 2023-01-05 16:01:58 +01:00
Robin Malfait
8b7cf61cf3
WIP 2023-01-05 16:01:58 +01:00
Jordan Pittman
0a6e97c122
Don’t match empty arbitrary values 2023-01-05 16:01:45 +01:00
Jordan Pittman
19b1e54ab5
Fix failing tests 2023-01-05 16:01:45 +01:00
Jordan Pittman
ee5da2e271
Include only unique values for tests
Really, what we care about most is that the list contains every expected candidate. Not necessarily how many times it shows up because while many candidates will show up A LOT in a source text we’ll unique them before passing them back to anything that needs them
2023-01-05 16:01:45 +01:00
Robin Malfait
b643c9e669
fix range to include \n 2023-01-05 16:01:45 +01:00
Robin Malfait
cceb585777
add failing tests
I noticed that some of the tests were failing, and while looking at
them, it happened because the tests were structured like this:

```html
    <div
      class="
        backdrop-filter
        backdrop-filter-none
        backdrop-blur-lg
        backdrop-brightness-50
        backdrop-contrast-0
        backdrop-grayscale
        backdrop-hue-rotate-90
        backdrop-invert
        backdrop-opacity-75
        backdrop-saturate-150
        backdrop-sepia
      "
    ></div>
```

This means that the class names themselves eventually end up like this: `backdrop-filter-none\n`
-> (Notice the `\n`)

/cc @thecrypticace
2023-01-05 16:01:45 +01:00
Robin Malfait
efb6015641
improve CI for the Oxide build 2023-01-05 16:01:43 +01:00
Robin Malfait
531125def7
enable tracing based on DEBUG env 2023-01-05 16:01:13 +01:00
Jordan Pittman
30b7d3fcc2
wip 2023-01-05 16:01:13 +01:00
Robin Malfait
52edffba86
cargo fmt 2023-01-05 16:01:13 +01:00
Robin Malfait
208eeb99f5
remove into_par_iter where it doesn't make sense 2023-01-05 16:01:13 +01:00
Robin Malfait
cc92ef53a6
add oxide
Our Rust related parts
2023-01-05 15:57:17 +01:00