tailwindcss/tests
Adam Wathan dce8280d76
[Oxide] Automatic content detection (#11173)
* resolve all _existing_ content paths

* pin `@napi-rs/cli`

* WIP: Log all resolved content files/globs

* only filter out raw changed content in non-auto mode

* skip parseCandidateFiles cache in `auto` mode

* improve algorithm of detecting content paths

1. Files in the root should be listed statically instead of using globs.
2. Files and folders in special known direct child folders should be
   listed statically instead of using globs (e.g.: `public`). This is
   because these special folders are often used to store generated AND
   source files at the same time. Using globs could trigger infinite
   loops because we are watching and acting upon dist files.
3. All file extensions found in the project, should be used in the globs
   in addition to a known set of extensions.
4. Direct folders seen from the root, can use the glob syntax
   `<root>/src/**/*.{...known-extensions}`

* inline wanted-extensions

Not 100% convinced yet, but seems cleaner so far.

* ensure writing an file also makes the parent folder(s)

* add integration tests for the auto content feature

* add pnpm and bun lock files

* Revert "inline wanted-extensions"

This reverts commit 879c1248524e84216125f4a24e0160b40736333a.

* sort binary-extensions and add lockb

* sort + add `lock` to ignored extensions

* drop `yarn.lock`, because lock extensions are already covered

* group template extensions

This will make it a bit easier to organize in the future.

* drop empty lines and commented lines from template-extensions

* skip the config path when resolving template files

The config file will automatically trigger a rebuild when this file is
changed. However, this should not be part of the template files because
that could cause additional css that's not being used.

* make `auto content` the default in the oxide engine

- In the oxide engine, the default `content: []` will be dropped from
  the default configuration (config.simple.js, config.full.js).
- If you have `content: []` or `content: { files: [] }` then the auto
  content feature won't be active. However if those arrays are empty a
  warning will still be shown. Adding files/globs or dropping the
  `content` section completely will enable auto content.

* only test the auto content integration test in the oxide engine

* set `content.files` to `auto` instead of using `auto: boolean`

This way we don't run into the issue where the `config.content.files` is
set and the `config.content.auto` is set to true.

* drop log

* ensure we validate the config in the CLI

* show experimental warning for automatic content detection

* use cached version of the getCandidateFiles instead of bypassing it

* use `is_empty()` shorthand

Thanks, Clippy!

* add test to ensure nested ignored folders are not scanned

* add `tempfile` for tests

* add auto content tests in Rust

* refactor auto content detection

This will also make sure that if we have (deeply) nested ignored
folders, then we won't use deeply nested globs (**/*.{js,html}) for the
parent(s) of the nested ignored folders but instead use a shallow glob
for each directory (*/*.{js,html}).

Then each sibling directory of the parent can use deeply nested globs
again except for the direct parent.

* use consistent comments

* ensure ignored static listed files are not present

* improve performance by ~30x

On a big test project this goes from ~6s to ~200ms

* improve performance by ~5x

We started with a ~6s duration
Then in the previous commit, we improved it by ~30x and it went down to
~200ms
Now with this change, it takes about ~40ms. That's another ~5x
improvement.

Or in total a ~150x improvement.

* ensure nested folders in `public/` are also explicitly listed

* add shortcut for normalizing files

This is only called once so won't do anything to the main performance of
Tailwind CSS. But always nice to make small performance improvements!

* run Rust tests in CI

* fix lint warnings

* update changelog

* Update CHANGELOG.md

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-05-12 18:49:35 +02:00
..
fixtures remove unused fixture files 2021-12-15 18:13:09 +01:00
plugins Fix gradient stop positions with transparent colors and/or variants (#11002) 2023-04-13 16:12:12 -04:00
postcss-plugins/nesting Improve CSS output in tests to better reflect reality (#10454) 2023-01-31 15:37:49 +01:00
util Replace __OXIDE__ at build time to prevent @tailwindcss/oxide leaks in the stable engine (#10988) 2023-04-18 12:19:20 +02:00
animations.test.js Improve CSS output in tests to better reflect reality (#10454) 2023-01-31 15:37:49 +01:00
any-type.test.js Fix gradient stop positions with transparent colors and/or variants (#11002) 2023-04-13 16:12:12 -04:00
apply.test.js Don’t move unknown pseudo-elements to the end of selectors (#10962) 2023-04-07 10:45:47 -04:00
arbitrary-properties.test.js Improve CSS output in tests to better reflect reality (#10454) 2023-01-31 15:37:49 +01:00
arbitrary-values.oxide.test.css Ensure repeating-conic-gradient is detected as an image (#11180) 2023-05-08 09:32:58 +02:00
arbitrary-values.test.css Ensure repeating-conic-gradient is detected as an image (#11180) 2023-05-08 09:32:58 +02:00
arbitrary-values.test.html Ensure repeating-conic-gradient is detected as an image (#11180) 2023-05-08 09:32:58 +02:00
arbitrary-values.test.js Normalize arbitrary modifiers (#11057) 2023-04-21 21:42:58 +02:00
arbitrary-variants.test.js Disallow multi-selector arbitrary variants (#10655) 2023-02-22 14:44:54 -05:00
basic-usage.oxide.test.css Fix gradient stop positions with transparent colors and/or variants (#11002) 2023-04-13 16:12:12 -04:00
basic-usage.test.css Fix gradient stop positions with transparent colors and/or variants (#11002) 2023-04-13 16:12:12 -04:00
basic-usage.test.js Add list-style-image support (#10817) 2023-03-20 14:40:35 -04:00
blocklist.test.js refactor log.warn checks in tests 2023-03-17 14:49:36 +01:00
collapse-adjacent-rules.test.js Disable color opacity plugins by default in the oxide engine (#10618) 2023-02-17 20:21:22 +01:00
collapse-duplicate-declarations.test.js Improve CSS output in tests to better reflect reality (#10454) 2023-01-31 15:37:49 +01:00
color-opacity-modifiers.test.js Fix gradient stop positions with transparent colors and/or variants (#11002) 2023-04-13 16:12:12 -04:00
color.test.js Parse alpha value from rgba/hsla colors when using variables (#10429) 2023-01-31 14:36:38 -05:00
combined-selectors.test.js Improve CSS output in tests to better reflect reality (#10454) 2023-01-31 15:37:49 +01:00
configurePlugins.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
containerPlugin.test.js Improve CSS output in tests to better reflect reality (#10454) 2023-01-31 15:37:49 +01:00
context-reuse.test.html inline tests (#10362) 2023-01-19 11:42:52 +01:00
context-reuse.test.js Improve CSS output in tests to better reflect reality (#10454) 2023-01-31 15:37:49 +01:00
custom-extractors.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
custom-plugins.test.js Improve CSS output in tests to better reflect reality (#10454) 2023-01-31 15:37:49 +01:00
custom-separator.test.js Make dark and rtl/ltr variants insensitive to DOM order (#10766) 2023-03-10 12:03:38 -05:00
custom-transformers.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
customConfig.test.js Enable ESM and TS based config files (#10785) 2023-03-15 17:04:18 -04:00
dark-mode.test.js Make dark and rtl/ltr variants insensitive to DOM order (#10766) 2023-03-10 12:03:38 -05:00
default-extractor.test.js Ensure multiple theme(spacing[5]) calls with bracket notation in arbitrary properties work (#11039) 2023-04-19 23:06:33 +02:00
defaultConfig.test.js Enable ESM and TS based config files (#10785) 2023-03-15 17:04:18 -04:00
defaultTheme.test.js Enable ESM and TS based config files (#10785) 2023-03-15 17:04:18 -04:00
detect-nesting.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
escapeClassName.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
evaluateTailwindFunctions.test.js Fix parsing of theme() inside calc() when there are no spaces around operators (#11157) 2023-05-04 10:20:01 -04:00
experimental.test.js Use :is to make important selector option insensitive to DOM order (#10835) 2023-03-21 17:50:44 +01:00
extractor-edge-cases.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
flattenColorPalette.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
format-variant-selector.test.js Fix issues with some pseudo-elements (#11111) 2023-04-27 12:21:28 -04:00
generate-rules.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
getClassList.test.js Revert "Remove blocklisted classes from autocomplete (#10844)" 2023-03-23 15:18:49 -04:00
getSortOrder.test.js Sort class lists deterministically for Prettier plugin (#10672) 2023-02-23 13:32:24 -05:00
getVariants.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
import-syntax.test.js Disable color opacity plugins by default in the oxide engine (#10618) 2023-02-17 20:21:22 +01:00
important-boolean.test.js Make dark and rtl/ltr variants insensitive to DOM order (#10766) 2023-03-10 12:03:38 -05:00
important-modifier-prefix.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
important-modifier.test.js Fix use of :where(.btn) when matching !btn (#10601) 2023-02-16 10:13:42 -05:00
important-selector.test.js Pull pseudo elements outside of :is and :has when using @apply (#10903) 2023-03-29 21:37:26 +02:00
kitchen-sink.test.js Fix gradient stop positions with transparent colors and/or variants (#11002) 2023-04-13 16:12:12 -04:00
layer-at-rules.test.js Improve CSS output in tests to better reflect reality (#10454) 2023-01-31 15:37:49 +01:00
layer-without-tailwind.test.js Improve CSS output in tests to better reflect reality (#10454) 2023-01-31 15:37:49 +01:00
match-components.test.js Improve CSS output in tests to better reflect reality (#10454) 2023-01-31 15:37:49 +01:00
match-utilities.test.js Revert "Prepare for the v3.2.6" 2023-02-08 17:39:43 +01:00
match-variants.test.js Disable color opacity plugins by default in the oxide engine (#10618) 2023-02-17 20:21:22 +01:00
min-max-screen-variants.test.js refactor log.warn checks in tests 2023-03-17 14:49:36 +01:00
minimum-impact-selector.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
modify-selectors.test.js Sort by layer inside variants layer (#10505) 2023-02-06 16:27:01 +01:00
mutable.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
negated-content-ignore.test.html Fix using negated content globs (#5625) 2021-09-29 11:15:31 +01:00
negated-content-include.test.html Fix using negated content globs (#5625) 2021-09-29 11:15:31 +01:00
negated-content.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
negateValue.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
negative-prefix.test.js Improve CSS output in tests to better reflect reality (#10454) 2023-01-31 15:37:49 +01:00
normalize-config.test.js [Oxide] Automatic content detection (#11173) 2023-05-12 18:49:35 +02:00
normalize-data-types.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
normalize-screens.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
opacity.test.js Disable color opacity plugins by default in the oxide engine (#10618) 2023-02-17 20:21:22 +01:00
oxide-svelte.test.css Fix gradient stop positions with transparent colors and/or variants (#11002) 2023-04-13 16:12:12 -04:00
oxide.test.js Revert "Prepare for the v3.2.6" 2023-02-08 17:39:43 +01:00
oxide.test.svelte Oxide (#10252) 2023-01-13 12:22:00 +01:00
parallel-variants.test.js Don’t move unknown pseudo-elements to the end of selectors (#10962) 2023-04-07 10:45:47 -04:00
parseAnimationValue.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
parseObjectStyles.test.js Improve CSS output in tests to better reflect reality (#10454) 2023-01-31 15:37:49 +01:00
prefers-contrast.test.js Disable color opacity plugins by default in the oxide engine (#10618) 2023-02-17 20:21:22 +01:00
prefix.test.js Make dark and rtl/ltr variants insensitive to DOM order (#10766) 2023-03-10 12:03:38 -05:00
prefixSelector.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
preflight.test.js Use Lightning CSS in the PostCSS Plugin (#10399) 2023-01-23 20:44:31 +01:00
raw-content.oxide.test.css Fix gradient stop positions with transparent colors and/or variants (#11002) 2023-04-13 16:12:12 -04:00
raw-content.test.css Fix gradient stop positions with transparent colors and/or variants (#11002) 2023-04-13 16:12:12 -04:00
raw-content.test.js Revert "Prepare for the v3.2.6" 2023-02-08 17:39:43 +01:00
relative-purge-paths.test.html inline tests (#10362) 2023-01-19 11:42:52 +01:00
relative-purge-paths.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
resolve-defaults-at-rules.test.js Improve CSS output in tests to better reflect reality (#10454) 2023-01-31 15:37:49 +01:00
resolveConfig.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
responsive-and-variants-atrules.test.js Improve CSS output in tests to better reflect reality (#10454) 2023-01-31 15:37:49 +01:00
safelist.test.js Disable color opacity plugins by default in the oxide engine (#10618) 2023-02-17 20:21:22 +01:00
screenAtRule.test.js Enable ESM and TS based config files (#10785) 2023-03-15 17:04:18 -04:00
shared-state.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
source-maps.test.js Fix parsing of theme() inside calc() when there are no spaces around operators (#11157) 2023-05-04 10:20:01 -04:00
syntax-lit-html.test.js Disable color opacity plugins by default in the oxide engine (#10618) 2023-02-17 20:21:22 +01:00
syntax-svelte.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
syntax-svelte.test.svelte Rename svelte tests 2021-09-21 12:37:49 -04:00
tailwind-screens.test.js Improve CSS output in tests to better reflect reality (#10454) 2023-01-31 15:37:49 +01:00
to-path.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00
variant-grouping.test.skip.js Improve CSS output in tests to better reflect reality (#10454) 2023-01-31 15:37:49 +01:00
variants.oxide.test.css Fix gradient stop positions with transparent colors and/or variants (#11002) 2023-04-13 16:12:12 -04:00
variants.test.css Fix gradient stop positions with transparent colors and/or variants (#11002) 2023-04-13 16:12:12 -04:00
variants.test.html a few minor fixes to the variants tests (#10427) 2023-01-27 19:57:02 +01:00
variants.test.js ensure stacking dark and rtl variants with pseudo elements works as expected 2023-03-21 15:32:16 +01:00
warnings.test.js [Oxide] Automatic content detection (#11173) 2023-05-12 18:49:35 +02:00
withAlphaVariable.test.js Run test suite against both engines (#10373) 2023-01-20 18:45:04 +01:00