Commit graph

1885 commits

Author SHA1 Message Date
Adam Wathan
fd500fcd0c Exclude variantPlugins from corePluginList
This change avoids unnecessarily registering variantPlugins twice.
2023-05-26 21:10:02 -04:00
Robin Malfait
04c4de1997
Deprecate --no-autoprefixer flag in the CLI (#11280)
* enable `--no-autoprefixer` test

* handle `--no-autoprefixer` using lightningcss

* bump default chrome version for lightningcss plugin

* handle `map` being nullable

* add `--no-autoprefixer` test including nesting

* set Chrome to version 111 as a default value

* resolve the output message when resolving the promise

* deprecate `--no-autoprefixer` for the CLI

* update changelog
2023-05-25 16:06:00 +02:00
Robin Malfait
581cf6abcc
Merge engines (#11275)
* Simplify CI, make oxide engine the default (#11281)

* remove integration tests for the `stable` engine

* make `integration-tests-oxide` the default integration tests workflow

* remove unnecessary CACHE_PREFIX

* drop `ci-stable.yml` workflow

* make `CI — Oxide` the default

+ drop testing against 3.3 branch (since this is stable only)
+ remove unnecessary CACHE_PREFIX

* drop `release-insiders-stable.yml` workflow

* make `Release Insiders — Oxide` the default

+ change release channel to just `insiders` instead of `oxide-insders`

* drop 3.3 branch from integration tests

* change job name for insiders release

This makes it consistent with the other job names

* prep `release-oxide.yml` workflow to be the default workflow

* add Tailwind Play update

Currently commented out until we figure out how this will work exactly.

* use `env.VERSION` for the version we want to release

* drop `release-stable.yml` workflow

* make `release-oxide.yml` the default `release.yml` workflow

* inline "Calculate environment variables" step

* cache node_modules and cargo related files/folders in the release step

* always use the default CLI

* drop oxide specific implementation

* ensure we test `--postcss` in the CLI

Even for the Oxide engine

* always process `@import` rules

* remove `generalizedModifiers` flag

This was already enabled by default. This commits removes some of the
outstanding references to it.

* remove built-in peer dependencies for the CLI

* drop unused esbuild dependency

* fix type for `configBag`

* setup Lightning CSS for the CLI

* drop `cssnano` dependency

We only used this in the CLI and we now use Lighting CSS which has this
built in already. Therefore we can get rid of this as a dependency.

* ensure `imported.css` file exists in integration tests

* passthrough `options` to lightningcss

Ideally we can read this from `result.map` instead. However this doesn't
get filled in for whatever reason even though we use `map: {inline:true}`.

You can run the `tests/cli.test.js`, and more specifically the
`--postcss supports process options with custom config` test.

* Always process CSS with Lightning CSS

Some tests temporarily skipped. Autoprefixer removed from `postcss.config.js` stubs since vendor prefixing handled by Lightning.

* Remove code for normalizing `@import "tailwindcss/*"` statements

* ensure tailwind doesn't crash when a `tailwind.config.js` file is not present

* add `log.group` to group multiple messages together with different types

* remove engine specific checks in integration tests

* remove unused imports/variables

Make linting check happy

* support `content: ['auto']`

This will allow us to still use auto content detection, but since this
is part of the `content` array, it also allows you to add custom paths
if you want.

E.g.:
```js
content: ['auto', './node_modules/my-library/*.{jsx,tsx}']
```

* ensure `content.files` is always an array

This allows us to simplify some checks because 'auto' will now be part
of the array instead of checking if `content.files` is auto or if it is
an array containing 'auto'.

* fix tests, ensure default config is not injected

* simplify `auto` normalization

* always use the defaultFullConfig

No need to override the defaultFullConfig with `{content: 'auto'}`
because this will be included in the default config already.

* drop condition which ensured `files` was an empty array

This is not needed anymore because when `content` is omitted it behaves
as if it was set to `auto`.

* drop removal of `content`

We used to remove the `content` from the actual configuration files when
using `tailwindcss init` for the oxide engine. This was to ensure that
`auto content detection` was used instead (by default).

But now it is always enabled by default therefore this is not needed
anymore.

* ensure setting `content: 'auto'` works

* improve file cache handling

We have to make sure that we get into the previous state whenver a test
is done.
We were using some `!fileCache[filePath]` checks, however we also used
`null` as a sentinel value when something wasn't found. But, `null` is
falsey as well so some checks where incorrect.

Using a dedicated value and a `Map` makes this safer and more correct
because we can now use `.has()`.

* drop `cleanupFile`, `removeFile` will already take care of it

* drop oxide check in `resolvedChangedContent`

At this point the `context.tailwindConfig.content.files` is already
fully resolved regardless of the engine we are in.

* refactor `parseCandidateStringsFromFiles` strategy, to make use of a proper feature flag

* use feature flag for sorting classes

Once the Oxide engine is the default default, then we can drop this
entirely because the result from the Rust parser will already be sorted.

* drop `crosscheck` from tests where it is safe

First pass of deleting `crosscheck`. These are all the places where we
didn't have any differences between the Oxide and Stable engine.

* replace `__OXIDE__` in corePlugins with feature flag

* use `globalThis.__OXIDE__ ?? false`

This will ensure that in places where we don't have `__OXIDE__` that we
can still properly fallback to `false`.

* use `flex` as the go-to utility when testing features

* prefer `space-utilities` tests instead of `oxide` test

* drop crosscheck check

Since the `oxideParser` is disabled by default, all the tests can use
the `stable` output.

* use simple `false` default values for feature flag defaults

* drop `__OXIDE__` injections in build scripts

* use stable `flex` and `z-{...}` utilities instead of color utilities

flex and z-index related utilities are more stable than the color
utilities right now because the color utilities will use a raw color
value or a combination with a css variable depending on a feature flag.

* drop unused `ENGINE` environment variable

* drop stable engine manifest files

* drop `swap-engines` tooling

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2023-05-24 22:10:00 -04:00
Daniel Kouznetsov
0af64ee3e8
fixed a type in generateRules.js (#11264) 2023-05-22 08:34:10 -04:00
Robin Malfait
f49b054b7d
[Oxide] Add built-in @import processing support (#11239)
* run PostCSS relative to test file

The PostCSS `from` was always set to the `tests/util/run` file with the
current test name as a query param to make it unique. However, that
results in issues with relative file paths because they are now relative
to this file instead of the actual test file.

Luckily, `expect.getState()` exposes the `testPath` value that points to
the current test file itself.

* add built in `@import` processing

+ additional features such that you can use `@tailwind` and `@config`
  directives before the `@import` at rule which isn't normally allowed.
  However "@tailwind" in a way is an `@import` and `@config` in a way is
  a `@charset` which can be used before the `@import` at rule.

* drop partial normalizeTailwindDirectives when in the Oxide engine

This will now be handled by Tailwind from a higher level, so the core
doesn't have to worry about normalizing this anymore since it will
always be normalized right now.

* add `handleImportAtRules` to CLI

* update changelog

* scope `import processing` to the oxide engine

* update Changelog

* use direct comparison

We don't need the `startsWith` check anymore because the contents of the
comment will be the actual value we expect.
2023-05-15 19:29:57 +02:00
Robin Malfait
0e171fd2dd
[Oxide] Ensure generated tailwind.config.js file is formatted properly (#11221)
* ensure beginning `\n` is not removed

The `\s` regex includes newlines `\n`, but we only want leading spaces
to be removed.

* update changelog
2023-05-13 00:15:30 +02:00
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
Robin Malfait
251cc37d7d
Ensure repeating-conic-gradient is detected as an image (#11180)
* ensure `repeating-conic-gradient` is detected as an image

* update changelog
2023-05-08 09:32:58 +02:00
Jordan Pittman
960cb40c6b
Fix parsing of theme() inside calc() when there are no spaces around operators (#11157)
* Refactor

* Don’t resolve functions for anything not using theme or screen

* Normalize math operators inside calc when handling functions

* Inline postcss-value-parser

* Treat all functions the same as calc

* Remove workaround for calc + operators without spaces

* Remove `postcss-value-parser` dependency

* Update lockfile

* Update sourcemaps

* Update changelog

* Update `value-parser` formatting

* Stop prettier from complaining
2023-05-04 10:20:01 -04:00
Adam Wathan
cdca9cbcfe
Update preflight.css 2023-04-28 22:39:08 -04:00
Eran Hirsch
7b3fe8de0f
Reset dialog element styles (#11069)
* disable useragent styling for dialog

* nits

* Update src/css/preflight.css

* Simplify dialog reset

We don’t want to reset everything here. Just the padding should be enough.

* Update test

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2023-04-28 12:51:52 -04:00
Dany Castillo
1f1a6faf2c
Make font settings propagate into buttons, inputs, etc. (#10940)
* Make font settings propagate into buttons, inputs, etc.

* update source-maps test due to preflight change

* update changelog

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-04-28 10:06:04 +02:00
Jordan Pittman
ef056a57d3
Fix issues with some pseudo-elements (#11111)
* Fix issues with some pseudo-elements

We’ve included pseudo elements for backdrop, marker, placeholder, and selection and they were all “jumpable” before we made changes in v3.3.2. Ideally they wouldn’t be because if they ever eventually have any interactivity that could become a problem.

* Update changelog
2023-04-27 12:21:28 -04:00
Robin Malfait
bd0497fc5d
Drop support for Node.js v12 (#11089)
* bump `postcss-load-config` in the oxide engine

* bump `postcss-load-config` in the stable engine

* update changelog

* Switch to stable

* Update Node to v14

* Update to latest dependency versions

* Update test helper for new version of `rimraf`

Co-Authored-By: Jordan Pittman <jordan@cryptica.me>

* Downgrade `lightningcss` to `v1.18.0`

Co-Authored-By: Jordan Pittman <jordan@cryptica.me>

* Switch back to oxide

* Update Github actions from Node 12 to Node 14

* Update oxide dependencies

* Update stable dependencies

* Update `content-resolution` integration test dependencies

* Update `postcss-cli` integration test dependencies

* Update `rollup` integration test dependencies

* Update `rollup-sass` integration test dependencies

* Update `vite` integration test dependencies

* Update `webpack-5` integration test dependencies

* Update changelog

* Remove `color-name` dependency

* Replace `quick-lru` dependency with `@alloc/quick-lru`

* Replace `quick-lru` dependency with `@alloc/quick-lru` in stable

* Fix standalone CLI test

---------

Co-authored-by: Jonathan Reinink <jonathan@reinink.ca>
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2023-04-25 16:28:20 -04:00
Robin Malfait
9bb45cd162
Normalize arbitrary modifiers (#11057)
* ensure we normalize the arbitrary modifiers

This applies the same rules as arbitrary values. The `_` can be used in
place of a space. If you _do_ want an underscore, you can escape it with
`\_` (`\\_` in JavaScript).

* update changelog
2023-04-21 21:42:58 +02:00
Robin Malfait
0e2b4510a2
Ensure multiple theme(spacing[5]) calls with bracket notation in arbitrary properties work (#11039)
* ensure that last `]` doesn't stop the match

Given this input:
```html
<div class="[width:_calc(theme(spacing[5])_+_theme(spacing[5]))]"></div>
```

Then we would expect the match to be this:
```
[width:_calc(theme(spacing[5])_+_theme(spacing[5]))]
```

However, with the `?`, then it would stop and result in:
```
[width:_calc(theme(spacing[5])_+_theme(spacing[5]
```

Which makes it incomplete because the `))]` are missing at the end.

* update changelog
2023-04-19 23:06:33 +02:00
Robin Malfait
72bc31867b
Replace __OXIDE__ at build time to prevent @tailwindcss/oxide leaks in the stable engine (#10988)
* replace `env.OXIDE` with global `__OXIDE__`

This will allow us to replace the `__OXIDE__` at build time, and fully
remove the branches from the final code so that there is not even any
reference to `@tailwindcss/oxide` on the stable engine.

* update changelog

* use `env.ENGINE` in integration tests

* drop oxide branching for the PostCSS plugin for now

This is currently a redirect to the same file, so doesn't hurt.

* Enable better dead-code elimination

* Update CLI tests

Fix indentation

* Fix indentation

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2023-04-18 12:19:20 +02:00
Matei Simtinică
9f860197c9
Fix gradient stop positions with transparent colors and/or variants (#11002)
* fixed gradient stop for default transparent

* Inherit gradient stop positions when using variants

* Update tests

* Update changelog

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2023-04-13 16:12:12 -04:00
Jordan Pittman
e3a9d5f53b
Don’t move unknown pseudo-elements to the end of selectors (#10962)
* Don’t move `::deep` pseudo element to end of selector when using `@apply`

* Update changelog

* Move pseudo-elements in two passes

* Rewrite pseudo-element relocation logic

* Update test

`::test` is an unknown pseudo element and therefore may be actionable _and_ nestable

* Add tests

* Simplify tests

* Simplify

* run tests on CI multiple times

This works around the timeouts/flakeyness of GitHub Actions

* Update formatting

* Add comment

* Mark webkit peusdo elements as terminal

* update comment

* only execute the `global-setup` once

* Simplify

NO SORT FN YAY

* Use typedefs

* Update changelog

* Update changelog

* update again

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-04-07 10:45:47 -04:00
Jordan Pittman
467a39e0d5
Don’t move ::ng-deep pseudo element to end of selector when using @apply (#10943)
* Don’t move `::ng-deep` pseudo element

* Update changelog
2023-04-04 12:46:20 -04:00
Jordan Pittman
474178055e Fix @tailwindcss/line-clamp warning (#10919)
* WIP

* Move warning to validateConfig

This only happens in setupTrackingContext outside of resolveConfig

* Use original dynamic require approach in `validateConfig`

The important thing is that this happens in Node-land only. It is outside of `resolveConfig` which is public and importable into user projects. That is the scenario that breaks because of static import hoisting.

* Don’t reference process when it might be undefined

The `resolveConfig` dep path is public which should not reference process. However, we have some behavior that changes based on env vars so we need to conditionalize it instead.

* Update changelog

* Formatting

* More formatting

* Update changelog

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
Co-authored-by: Jonathan Reinink <jonathan@reinink.ca>
2023-03-30 15:06:45 -04:00
Robin Malfait
9cd0301b0a
Drop @tailwindcss/line-clamp warning (#10915)
* drop `@tailwindcss/line-clamp` check

This won't work in places where `require` calls are hoisted so that
they become static imports. This means that in some projects this
`require` call was breaking the full application even though it was
intentionally put in a try/catch block...

* update changelog
2023-03-30 18:42:38 +02:00
Robin Malfait
447384bcbe
cleanup unused import 2023-03-29 23:05:19 +02:00
Jordan Pittman
0ecc4642fc
Pull pseudo elements outside of :is and :has when using @apply (#10903)
* Pull pseudo elements outside of `:is` and `:has` when using `@apply`

* Update changelog

* Refactor

* Update important selector handling for :is and :has

* fixup

* fixup

* trigger CI

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-03-29 21:37:26 +02:00
Robin Malfait
a785c93b54
Try resolving config.default before config to ensure the config file is resolved correctly (#10898)
* try to use `config.default` before using `config`

* update changelog

* add quick `SHOW_OUTPUT` toggle for integration tests

Setting this to `true` shows the output of the executed commands.

* add integration tests for `tailwind.config.ts` and `tailwind.config.js` with ESM syntax
2023-03-29 16:52:22 +02:00
Robin Malfait
51157717da
Add gradient color stop position utilities (#10886)
* add gradient color stop positions

* update tests to include gradient position color stop reset values

* add dedicated color stop position tests

* use `%` sign in the name of the uility

* update changelog

* ensure `length` values and css variables work
2023-03-28 15:39:00 +02:00
Jonathan Reinink
fb796cd2ec
Extend default color palette with new 950 shades (#10879)
* Add 950 colors

* Update changelog
2023-03-27 14:47:13 -04:00
Robin Malfait
55aa4035f5
Fix format assumption when resolving module dependencies (#10878)
* fix assumption when resolving dependencies

When resolving dependencies given a path, we are only interested
relative files from the current file. We are not interested in the
dependencies that are listed in your `package.json` and thus in your
`node_modules` folder.

We made the assumption that your imports have at least 3 characters.
This sort of makes sense because there will be a `.`, then the OS
separator like `/` and than a file name. E.g.: `./a` is the minimal
amount of characters.

This makes sense for `import` statements, but in the case of `require`,
it is totally valid to write `require('.')`. This will require the
current `index.{js,ts,mjs,cjs,...}` in the current directory.

Before this change, having a `require('.')` wouldn't crash, but the
dependency would not be marked as a module dependencies and therefore we
won't listen for file changes for that dependency.

* update changelog
2023-03-27 19:41:20 +02:00
Robin Malfait
8e85a865da
Ensure module dependencies for value null, is an empty Set (#10877)
* ensure we have no dependencies when `absoluteFilePath` is `null`

This happens in the CLI where we don't have a guaranteed `path` for the
config file. This can happen in practice if you use:

```console
npx tailwindcss --content ./index.html -o ./output.css
```

... and if you don't have a `tailwind.config.{js,ts,cjs,...}` in the
current directory.

* update changelog
2023-03-27 19:09:06 +02:00
Robin Malfait
5b77b42574
Reset all properties when using line-clamp-none (#10876)
* reset other properties on `line-clamp-none`

* update CHANGELOG
2023-03-27 18:56:14 +02:00
Brandon McConnell
47b8289aba
Add support for white-space: break-spaces (#10729) 2023-03-24 11:30:37 -04:00
Jordan Pittman
6ed3ba365d Update warning message 2023-03-24 10:44:18 -04:00
Jordan Pittman
6138d69c1b
Warn when @tailwindcss/line-clamp plugin is being used (#10862)
* Warn if line-clamp plugin is installed

* Replace line-clamp in standalone CLI

* Update import

* Remove line-clamp plugin if found

* update lockfiles

* Update changelog
2023-03-24 09:58:06 -04:00
Jordan Pittman
1d505e9c8c Revert "Remove blocklisted classes from autocomplete (#10844)"
This reverts commit f1473f53bb.
2023-03-23 15:18:49 -04:00
Jordan Pittman
f1473f53bb
Remove blocklisted classes from autocomplete (#10844)
* Remove blocklisted classes from autocomplete

* Update changelog

* Don't unnecessary loop over classes

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-03-23 15:03:56 -04:00
Adam Wathan
266f0292ba
Use :is to make important selector option insensitive to DOM order (#10835)
* Use `:is` to make important selector option insensitive to DOM order

* WIP

* add `applyImportantSelector` helper

* use new `applyImportantSelector`

* update tests

* remove unnecessary slice adjustment

Not 100% sure.

* update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2023-03-21 17:50:44 +01:00
Adam Wathan
bac5ecf004
Add list-style-image support (#10817)
* add `listStyle` instead of `listStyleType`

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Jordan Pittman <jordan@cryptica.me>

* add `listStyleType` related deprecation warnings

* Implement list-style-image as separate plugin

* Remove unused code, update tests

* Always generate `list-none`, don't pull it from theme

* Gracefully handle missing listStyleType configuration

* Just use `list-image-*` fuck it

* Update changelog

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
Co-authored-by: Peter Neupauer <peter@neupauer.sk>
2023-03-20 14:40:35 -04:00
Robin Malfait
439fdadb3a
ensure we look at the extension from the "parent" file
If you have a file `./a.js`, and you import `./b`, then `./b` should be
resolved based on the `./a.js` extension and use the
`jsResolutionOrder`.
2023-03-20 19:02:52 +01:00
Robin Malfait
e046a37dbc
Improve bundle size by replacing detective-typescript (#10825)
* replace `detective-typescript` with our own implementation

We are not parsing the code but just trying to pluck out the
dependencies used via `import` and `require`.

* drop `detective-typescript`

* return a `Set` instead of an `Array`

* resolve rebuilds, but log errors in case they occur

This won't be the prettiest if it happens, but at least we are not
swallowing errors which should make bugs be easier to discover.

See previous commit for an example... 😅

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
2023-03-20 18:30:47 +01:00
Robin Malfait
7e9a53f6cb
Enable ESM and TS based config files (#10785)
* add `jiti` and `detective-typescript` dependencies

* use `jiti` and `detective-typescript`

Instead of `detective`, this way we will be able to support
`tailwind.config.ts` files and `ESM` files.

* use `@swc/core` instead of the built-in `babel` form `jiti`

* update changelog

* add `jiti` and `detective-typescript` dependencies to `stable`

* use `sucrase` to transform the configs

* add `sucrase` dependency to `stable` engine

* make loading the config easier

* use abstracted loading config utils

* WIP: make `load` related files public API

* use new config loader in PostCSS plugin

* add list of default config files to look for

* cleanup unused arguments

* find default config path when using CLI

* improve `init` command

* make eslint happy

* keep all files in `stubs` folder

* add `tailwind.config.js` stub file

* Initialize PostCSS config using the same format as Tailwind config

* Rename config content stubs to config.*.js

* Improve option descriptions for init options

* Remove unused code, remove `constants` file

* Fix TS warning

* apply CLI changes to the Oxide version

* update `--help` output in CLI tests

* WIP: make tests work on CI

TODO: Test all combinations of `--full`, `--ts`, `--postcss`, and `--esm`.

* wip

* remove unused `fs`

* Fix init tests

Did you know you could pass an empty args to a command? No? Me neither. ¯\_(ツ)_/¯

* bump `napi-derive`

* list extensions we are interested in

* no-op the `removeFile` if file doesn't exist

* ensure all `init` flags work

* ensure we cleanup the new files

* test ESM/CJS generation based on package.json

* remove unnecessary test

We are not displaying output in the `--help` anymore based on whether
`type: module` is present or not.
Therefore this test is unneeded.

* only look for `TypeScript` files when the entryFile is `TypeScript` as well

* refactor `load` to be `loadConfig`

This will allow you to use:

```js
import loadConfig from 'tailwindcss/loadConfig'

let config = loadConfig("/Users/xyz/projects/my-app/tailwind.config.ts")
```

The `loadConfig` function will return the configuration object based on
the given absolute path of a tailwind configuration file.

The given path can be a CJS, an ESM or a TS file.

* use the `config.full.js` stub instead of the `defaultConfig.stub.js` file

The root `defaultConfig` is still there for backwards compatibilty
reasons. But the `module.exports = requrie('./config.full.js')` was
causing some problems when actually using tailwindcss.

So dropped it instead.

* apply `load` -> `loadConfig` changes to `Oxide` engine CLI

* ensure we write the config file in the Oxide engine

* improve type in Oxide engine CLI

* catch errors instead of checking if the file exists

A little smaller but just for tests so doesn't matter too much here 👍

* ensure we publish the correct stub files

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
Co-authored-by: Nate Moore <nate@natemoo.re>
Co-authored-by: Enzo Innocenzi <enzo@innocenzi.dev>
2023-03-15 17:04:18 -04:00
Robin Malfait
7eab762a3d
Add line-clamp utilities from @tailwindcss/line-clamp to core (#10768)
* add `lineClamp` utility

This is coming from the `@tailwindcss/line-clamp` package that we now
merged into the core of Tailwind itself.

* update changelog
2023-03-10 18:47:43 +01:00
Adam Wathan
e40b73a127
Make dark and rtl/ltr variants insensitive to DOM order (#10766)
* Make `dark` and `rtl`/`ltr` variants insensitive to DOM order

* Add explicit test for stacking dark and rtl variants

* Update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2023-03-10 12:03:38 -05:00
Robin Malfait
ba56e426af
Use inset instead of top, right, bottom, and left properties (#10765)
* use `inset` instead of `top`, `right`, `bottom` and `left` properties

* update changelog
2023-03-10 16:52:08 +01:00
Adam Wathan
c7d605f8c5
Remove warnings when using RTL/LTR variants (#10764)
* Remove warnings when using RTL/LTR variants

* Update changelog

---------

Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
2023-03-10 10:35:41 -05:00
Dany Castillo
e366985a82
Add content-normal and content-stretch utilities (#10645)
* Add content-stretch utility

* Add `content-normal` utility

---------

Co-authored-by: Jonathan Reinink <jonathan@reinink.ca>
2023-03-01 09:03:50 -05:00
Robin Malfait
1874798bdd
Ensure CLI builds have a non-zero exit code on failure (#10703)
* ensure simple builds have a non-zero exit code on failure

This is not used for the watcher.

* update changelog
2023-02-28 16:50:06 +01:00
Jordan Pittman
d2a95a00a8
Sort class lists deterministically for Prettier plugin (#10672)
* Ensure class sorting is deterministic for Prettier

* Update changelog
2023-02-23 13:32:24 -05:00
Jordan Pittman
9bbdd9b10d
Disallow multi-selector arbitrary variants (#10655)
* Allow escaping in `splitAtTopLevelOnly`

* Correctly parse arbitrary variants that have multiple selectors

* Explicitly disallow multiple selector arbitrary variants

Now that we parse them correctly we can restrict them to explicitly supporting only a single selector

* Add test to verify that multiple selector arbitrary variants are dropped

* Add test

* Make prettier happy

* Fix CS

* Update changelog
2023-02-22 14:44:54 -05:00
Robin Malfait
962eb52ec6
Enable relative content paths for the oxide engine (#10621)
* enable `relativeContentPathsByDefault` for the `oxide` engine

* update tests to reflect `relative` change in the `oxide` engine

* update changelog
2023-02-17 21:42:10 +01:00
Robin Malfait
c8bf2d49b6
Disable color opacity plugins by default in the oxide engine (#10618)
* disable color opacity plugins by default for the `oxide` engine

* update tests to reflect this change in the `oxide` engine

* update changelog

* reflect changes in integration tests
2023-02-17 20:21:22 +01:00